1.content_by_lua_block作用:在http内容处理阶段生成数据
server { listen 80; server_name www.a.com; charset koi8-r; location = /test { default_type ‘text/plain‘; -- content_by_lua_block 执行阶段 content_by_lua_block { ngx.say("hello world") } } }
2.json解释库 -- cjson
location = /test1 { content_by_lua_block { local cjson = require "cjson" ngx.say(cjson.encode{a=1,b=2,c=3}) } }
原文:https://www.cnblogs.com/hixiaowei/p/12772688.html