On Thu, Feb 4, 2016 at 8:56 AM, Yichun Zhang (agentzh)
<age...@gmail.com> wrote:
> Hello!
>
> On Fri, Jan 29, 2016 at 10:30 PM, 罗厚付 wrote:
>> stack traceback:
>> coroutine 0:
>> /opt/openresty/lua/test.lua: in function </opt/openresty/lua/test.lua:1>
>> while sending to client, client: *.*.*.* , server: _, request: "POST
>> /index.php HTTP/1.0", host: "*.*.*"
>> 2016/01/28 23:27:36 [error] 15773#0: *16809007 lua entry thread aborted:
>> runtime error: /opt/openresty/lua/test.lua:82: attempt to index local
>> 'res1_body' (a userdata value)
>>
>>
>> 81 local res1_body = cjson.decode(res1.body)
>> 82 if res1_body and res1_body.code ~= 1 then
>> 83 return print(res1.body)
>> 84 end
>
> 貌似 cjson.decode() 返回了 ngx.null 值(这是一个 userdata),即 res1.body
> 的内容很可能是"null". 你的判断应该这么写:
>
> if res1_body and res1_body ~= ngx.null and res1_body.code ~= 1 then
>
春哥神级回复, 7*24 永远直击关键代码...
> Regards,
> -agentzh
>
> --
> --
Life's Pathetic, Let's Pythonic! 人生苦短, Python是岸!
俺: http://zoomquiet.io
授: http://creativecommons.org/licenses/by-sa/2.5/cn/
怒: 冗余不做,日子甭过!备份不做,十恶不赦!
KM keep growing environment culture which promoting organization be learnning!