我试图解析从MySQL数据库中提取的json字符串。 json字符串包含一个二维数组,但json_decode返回null,json_last_error返回0,我认为这意味着没有发生错误。
$ result是json字符串
json_decode($result, true);
字符串:
[
["17544500374","17544500489","17544500571","17544500587","17544500528"],
["17544500651","17544500432","17544500673","17544500452","17544500362"],
["17544500454","17544500457","17544500523","17544500441"],
["17544500547","17544500463","17544500535","17544500676"],
["17544500548","17544500581","17544500584","17544500382"],
["17544500593","17544500364","17544500660","17544500595"],
["17544500635","17544500647","17544500529","17544500670"]
]
答案 0 :(得分:1)
您的值没有密钥。这意味着,您的第二个参数不正确,因为该函数无法创建关联数组。
这适用于我的mashine:
json_decode($result);
答案 1 :(得分:0)
$result
必须是字符串:
$result = '[["17544500374","17544500489","17544500571","17544500587","17544500528"],["17544500651","17544500432","17544500673","17544500452","17544500362"],["17544500454","17544500457","17544500523","17544500441"],["17544500547","17544500463","17544500535","17544500676"],["17544500548","17544500581","17544500584","17544500382"],["17544500593","17544500364","17544500660","17544500595"],["17544500635","17544500647","17544500529","17544500670"]]'