› NGINX
› NGINX Trac
› 3rd Party Modules
› Security Advisories
› CHANGES
› OpenResty
› ngx_lua
› Tengine
在线学习资源
› NGINX 开发从入门到精通
NGINX Modules
› ngx_echo
kingcandyy
V2EX  ›  NGINX

请问如何在自己的模块中使用系统提供的变量

  •  
  •   kingcandyy · May 4, 2015 · 3379 views
    This topic created in 4177 days ago, the information mentioned may be changed or developed.
    比如我要在自己的模块中打印出$host信息,该如何使用这个变量啊
    Archangel_SDY
        1
    Archangel_SDY  
       May 4, 2015
    如果你只是要 host 的值,你可以从 ngx_http_request_t 中拿到。
    如果你想让自己模块的配置项支持这种带变量的表达式,那么你需要 ngx_http_script_compile 先对表达式编译,然后用 ngx_http_script_run 获取结果。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   936 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 20:45 · PVG 04:45 · LAX 13:45 · JFK 16:45
    ♥ Do have faith in what you're doing.