Home > Backend Development > PHP Tutorial > 为何json解析之后跟原来的不一样

为何json解析之后跟原来的不一样

WBOY
Release: 2016-06-13 11:55:38
Original
996 people have browsed it

为什么json解析之后跟原来的不一样

http://api.map.baidu.com/direction/v1?mode=driving&origin=永兴村&destination=清华大学&origin_region<br />=舟山&destination_region=北京&output=json&ak=gfPnxaaiPyNIhM7c3eZ1kmEL
Copy after login
得到的json数据被json_decode之后就变成了这样Array ( [status] => 2 [message] => Parameter Invalid [info] => Array ( [copyright] => Array ( [text] => @2014 Baidu - Data [imageUrl] => http://api.map.baidu.com/images/copyright_logo.png ) ) [result] => Array ( ) ) ,数据都去哪里了啊
------解决方案--------------------
直接浏览器访问 http://api.map.baidu.com/direction/v1?mode=driving&origin=永兴村&destination=清华大学&origin_region<br />=舟山&destination_region=北京&output=json&ak=gfPnxaaiPyNIhM7c3eZ1kmEL
得到
{<br />    "status":2,<br />    "message":"Parameter Invalid",<br />    "info":{<br />        "copyright":{[            "text":"@2014 Baidu - Data",<br />        "imageUrl":"http://api.map.baidu.com/images/copyright_logo.png"<br />      }<br />    },<br />    "result":[<br />    ]<br />}
Copy after login
其中 "message":"Parameter Invalid"
参数无效

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