1.比如post表单,传body 形式非json格式 而是 username=admin&password=password
ngx.req.read_body() local args = ngx.req.get_body_data()
local asArr = split(args,"&") if asArr then for key,val in pairs(asArr) do local subArr = split(val,"=") print(subArr[1]) end end
function split(s, p) local rt= {} string.gsub(s, '[^'..p..']+', function(w) table.insert(rt, w) end ) return rt end