json字符串转数组问题

WBOY
Release: 2016-06-23 13:22:48
Original
747 people have browsed it

string(186) "{"id":"2","num":2,"store":"9","name":"泰明顿磨损顿报警线(前,后)","price":"88.00"}"
string(96) "{"id":"2","num":1,"store":"9","name":"泰明顿磨损顿报警线(前,后)","price":"88.00"}"

上面2个json字符串, 看着长度是一样的, 打印出来一个186,一个96, 96的这个可以用json_decode转成数组,186那个却不行,求助~~


回复讨论(解决方案)

后一个长度是 96,是正常的 json 串,所以能解码
前一个长度是 186,显然还包含了其他内容,自然就不能解码了。你可在文本方式下观察 var_dump 的结果

后一个长度是 96,是正常的 json 串,所以能解码
前一个长度是 186,显然还包含了其他内容,自然就不能解码了。你可在文本方式下观察 var_dump 的结果


非常感谢!解决了!
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!