hello!
由于需要对所有请求的参数进行合法性检查,所以把参数检查的操作放到一个lua文件中作为公共函数调用,文件内容简要如下
1.public_check.lua
function new(self)
print(get_uri_args()["app_id"])
return setmetatable({}, mt)
end
2.service_1.lua
local public= require "public_check"
local form, err = public:new()
3.nginx.conf
lua_code_cache on;
location ~^/v2/(.+) {
default_type 'text/plain';
access_by_lua_fileservice_1;
}
以上代码在运行的时候发现第一请求过来的时候 print能打印出值,第二次请求过来的时候就变成nil,但是app_id实际上是有传过来的。
但是把lua_code_cache 改成off以后就正常了,
以上问题是什么原因呢,期待大神解惑啊,急急急!
以上谢谢。