openresty(nginx+lua)中获取不到post数据,ngx.req.get_body_data返回nil This function returns nil if the request body has not been read, the request body has been read into disk temporary files, or the request body has zero size. 打开nginx调试日志 error_log /var/log/ng
local str = "aaa.bbb.bbb.txt" --获取文件名 function getFileName(str) local idx = str:match(".+()%.%w+$") if(idx) then , idx-) else return str end end --获取扩展名 function getExtension(str) return str:match(".+%.(%w+)$") end ngx.say(&q
--获取客户端ip function get_client_ip() local headers=ngx.req.get_headers() local ip=headers["X-REAL-IP"] or headers["X_FORWARDED_FOR"] or ngx.var.remote_addr or "0.0.0.0" return ip end
更多好的文章就在 blog.haoitsoft.com,请大家多多支持! local getTime = os.date("%c"); 其中的%c可以是以下的一种:(注意大小写) %a abbreviated weekday name (e.g., Wed) %A full weekday name (e.g., Wednesday) %b abbreviated month name (e.g., Sep) %B full month name (e.g., September) %
更多好的文章就在 blog.haoitsoft.com,请大家多多支持! local getTime = os.date(“%c”); 其中的%c可以是以下的一种:(注意大小写) %a abbreviated weekday name (e.g., Wed) %A full weekday name (e.g., Wednesday) %b abbreviated month name (e.g., Sep) %B full month name (e.g., September) %c dat
android下: local luaj = require ("framework.luaj") local ok,ret = luaj.callStaticMethod("com/test/pokemon/testClass","getClipText",nil,"()S") 参数1:类名 参数2:静态方法 参数3:需要传的参数 参数4:返回类型 ()带表传递参数为空 S返回为string类型 public sta
参考此文http://blog.csdn.net/zjg555543/article/details/39177971 在Linux下可以直接运行 #!/usr/bin/lua5. --需要luacurl http://luacurl.luaforge.net/ --luajson https://github.com/mbalmer/luajson require("luacurl") require('json') function get_html(url, c) local r
安装lua_nginx_module 模块 lua_nginx_module 可以一步步的安装,也可以直接用淘宝的OpenResty Centos和debian的安装就简单了.. 这里说下freebsd的安装: fetch http://www.lua.org/ftp/lua-5.1.4.tar.gz tar zxvf lua-5.1.4.tar.gz cd lua-5.1.4 make freebsd make install cd .. fetch https://github.com/ch