问题描述
worker_processes 4;error_log logs/error.log;events { worker_connections 1024;}http { lua_package_path '/app/lua/?.lua;/usr/local/openresty/lualib/resty/?.lua;;'; lua_code_cache off; server {listen 6699;charset utf-8;#lua_need_request_body on;location ~ ^/api/([-_a-zA-Z0-9/]+) { #echo $remote_addr; default_type application/json; access_by_lua_file lua/bootstrap.lua; content_by_lua_file lua/$1.lua;} }}
lua脚本里面的ngx.var是个空table
问题解答
回答1:确实打印不出来,但是单个却可以例如ngx.var.remote_addr,ngx.var.args(假如uri有参数的话),求高手回答为什么输出不出啦.http://www.cnblogs.com/raiche... 这些貌似都可以
回答2:我认为是打印ngx.var的方法有误,ngx.var是一个table,需要实现一个函数打印table。
参考https://gist.github.com/range...