不好意思,没提供详细的描述。
环境:nginx-1.2.3 ngx_lua 0.7 luajit-2.0 centos-5.8 32位
content_by_lua_file "/usr/local/nginx/conf/lua"
lua代码:
local func = function (m)
return "\"http://"..string.reverse(m[1])..m[2]
end
body1,_=ngx.re.gsub(body1,"['\"]http://(.*?)([/'\"])",func)
body1的内容为百度首页源代码。
On Saturday, October 13, 2012 3:01:44 AM UTC+8, agentzh wrote:
Hello!刚才我回的邮件没写完就不小心发送出去了,不好意思。下面接着写:
On Fri, Oct 12, 2012 at 11:55 AM, agentzh wrote:
> 我的 nginx.conf 片段是
>
> location = /lua {
> content_by_lua_file html/a.lua;
> }
>
> 而 html/a.lua 的内容是:
>
> local body1 = "'http://agentzh.org'"
> local func = function (m)
> return "\"http://"..string.reverse(m[1])
> end
> body1,_=ngx.re.gsub(body1,"['\"]http://(.*?)([/'\"])",func)
> ngx.say(body1)
然后请求这里定义 /lua 的结果在我这里是期望的:
"http://gro.hztnega
所以请你也能提供像我上面给出的这样比较完整的示例,这样我才有可能在我这里复现你遇到的问题,否则就只能靠猜测了(像上面那样) :)
同时也希望你能在 bug 报告中总是主动提供像软件版本号(在这里就是 ngx_lua 和 nginx 的版本)、操作系统的种类(包括是 32
位的还是 64 位的)等重要信息。
多谢!
-agentzh