Home  >  Article  >  Backend Development  >  php获取通过url的json数据,返回的是空值,该如何处理

php获取通过url的json数据,返回的是空值,该如何处理

WBOY
WBOYOriginal
2016-06-13 11:57:171567browse

php获取通过url的json数据,返回的是空值
http://php.net/api/apply.php?&apply={"apply":{"name":"4747474","site":"http:\/\/4444444444444444","icon":"47","information":"474","about":"747","weibo":"74444444444","email":"74444444444444444","moblie":"89742589633","isfree":"y","applytime":1349939108}}

这个是一个链接,我在这个页面上要怎么把那段json格式给接下出来呢?
------解决方案--------------------
$x = json_decode($_GET['apply']);
------解决方案--------------------
var_dump(json_decode($_GET['apply'],true));
看輸出什麽?
------解决方案--------------------
var_dump(json_decode(urldecode($_GET['apply']),true));
------解决方案--------------------

print_r(json_decode('{"apply":{"name":"4747474","site":"http:\/\/4444444444444444","icon":"47","information":"474","about":"747","weibo":"74444444444","email":"74444444444444444","moblie":"89742589633","isfree":"y","applytime":1349939108}}'));
stdClass Object<br />(<br />    [apply] => stdClass Object<br />        (<br />            [name] => 4747474<br />            [site] => http://4444444444444444<br />            [icon] => 47<br />            [information] => 474<br />            [about] => 747<br />            [weibo] => 74444444444<br />            [email] => 74444444444444444<br />            [moblie] => 89742589633<br />            [isfree] => y<br />            [applytime] => 1349939108<br />        )<br /><br />)<br /><br />

------解决方案--------------------
LZ地址中参数apply前面多了个&符号,你看会不会是这个的问题

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