Skip to content

Commit 133be82

Browse files
committed
openresty 官方简单案例,在location 中调用Lua文件
1 parent 125a3d6 commit 133be82

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Openresty/Lua-file/lua-01.lua

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ return _M
88

99
--[[
1010
location /lua_file {
11-
default_type 'text/html'; -- 设置该行,则在浏览器就可以访问了
12-
lua_code_cache off; -- 关闭缓存
11+
default_type 'text/html'; -- 设置该行,则在浏览器就可以访问了
12+
lua_code_cache off; -- 关闭缓存
1313
content_by_lua_block {
14-
local mydata = require "../Lua/lua-01"
14+
local mydata = require "../Lua/lua-01" -- 注意这个路径 conf/nginx.conf 为相对路径的
1515
ngx.say(mydata.get_age("dog"))
1616
}
1717
}

0 commit comments

Comments
 (0)