Groups
Groups
Sign in
Groups
Groups
openresty
Conversations
Labels
About
Send feedback
Help
遇到cjson.decode后,遍历这个table,找不到参数的问题,求教
44 views
Skip to first unread message
tan winfan
unread,
Dec 21, 2018, 5:49:56 AM
12/21/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to openresty
local req = self.params
local dev = {}
dev["devId"] = req["devId"]
local devInfo = cjson.decode(self.params.devInfo) -- 我这个参数是json
--把devinfo所有值遍历存放到dev
for k, v in ipairs(devInfo) do
dev[string.lower(k)] = v --这里打印为空,devInfo tabla 长度为0是怎么回事
end
quzhi
unread,
Dec 24, 2018, 8:33:32 PM
12/24/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to openresty
hi
ipairs 只能遍历数组,你可以使用
pairs
在 2018年12月21日星期五 UTC+8下午6:49:56,tan winfan写道:
tianxia...@gmail.com
unread,
Dec 26, 2018, 1:56:07 AM
12/26/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to openresty
ipairs 是自然KEY 你试试pairs
在 2018年12月21日星期五 UTC+8下午6:49:56,tan winfan写道:
local req = self.params
Reply all
Reply to author
Forward
0 new messages