HttpLuaModule 获取Get和Post参数
获取 参数 get post
2023-09-27 14:25:30 时间
Get方式:
local id = tostring(ngx.var.arg_id) local type = tostring(ngx.var.arg_type)
Post方式:
ngx.req.read_body() local args = ngx.req.get_post_args() local id = tostring(args["id"]) local type = tostring(args["type"])
两种方式混合
local request_method = ngx.var.request_method local args = nil if "GET" == request_method then nginx.say("Get") args = ngx.req.get_uri_args() else nginx.say("Post") ngx.req.read_body() args = ngx.req.get_post_args() end local id = tostring(args["id"]) local type = tostring(args["type"])
【其他备忘】
获取IP地址
local ip_addr = tostring(ngx.var.remote_addr)
当前时间
tostring(os.date("%Y-%m-%d %H:%M:%S"))
相关文章
- js获取URL协议,主机头,端口,路径,参数,锚点
- AngularJs 1.5 $location获取url参数
- uni-app - H5 端获取当前页面的路由和参数(得到当前页面地址的路径 URL)
- 《HTML5 2D游戏编程核心技术》——第2章,第2.2节获取资源
- AngularJS路由系列(4)-- UI-Router的$state服务、路由事件、获取路由参数
- js获取url上的指定参数
- Swift3.0语言教程获取C字符串
- 漏洞复现篇——利用XSS漏洞获取cookie
- JS获取浏览器窗口大小 获取屏幕,浏览器,网页高度宽度
- JS获取地址栏参数转换为对象
- 关于xcode:如何在Objective-C中使用符号断点获取参数
- js获取精确宽度/高度(带小数位像素)
- 获取request中的查询参数
- dvwa下利用xss获取cookie并利用(绕过验证)
- 通过window.location.search获取页面url传递的参数
- MVC View中获取action、controller、area名称、参数
- aspx页面怎么用获取到的参数?
- 参数上使用自定义注解在aop中无法获取到该参数