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

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

WBOY
WBOYOriginal
2016-06-23 13:58:24784browse

http://api.map.baidu.com/direction/v1?mode=driving&origin=永兴村&destination=清华大学&origin_region=舟山&destination_region=北京&output=json&ak=gfPnxaaiPyNIhM7c3eZ1kmEL
得到的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
=舟山&destination_region=北京&output=json&ak=gfPnxaaiPyNIhM7c3eZ1kmEL
得到

{    "status":2,    "message":"Parameter Invalid",    "info":{        "copyright":{[            "text":"@2014 Baidu - Data",        "imageUrl":"http://api.map.baidu.com/images/copyright_logo.png"      }    },    "result":[    ]}
其中 "message":" Parameter Invalid"
参数无效

Statement:
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