后端之前是PHP5.3.13现在迁移到PHP5.3.9上前后端代码都没有改,之前的环境运行这些代码是没有任何问题的,现在前台现在却提示“Unexpected token in JSON at position 0”,我查了一下,意思是返回的数据不是JSON格式。。
返回数据如下:
[
{
"id": "74",
"create_time": "2016-08-04 16:19:21",
"content": "metal\u516c\u5f0016G\u767d\u8272\/\u7c89\u8272\u5df2\u5230\u8d27\uff0c\u5404\u5e97\u8bf7\u81ea\u884c\u4e0b\u5355",
"sender": "\u5434\u5c0f\u9f99",
"is_delete": "0"
},
{
"id": "73",
"create_time": "2016-07-13 13:45:23",
"content": "MX5\u516c\u5f0016G\u7070\u8272\u5df2\u5230\u8d27\uff0c\u4e13\u5356\u5e97\u8bf7\u81ea\u884c\u4e0b\u5355",
"sender": "\u5434\u5c0f\u9f99",
"is_delete": "0"
}
]
Chrome这里也有个红点提示
之前返回的数据是没有的,是否代表问题在后端?
后端PHP返回数据代码如下:
$list=array();
while($notify=mysql_fetch_assoc($result)){
$list[]=$notify;
}
echo json_encode($list);
这就不是很明白问题出现在哪里了,请高手指教.
就是数据格式不合法,你再查查