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
(
[apply] => stdClass Object
(
[name] => 4747474
[site] => http://4444444444444444
[icon] => 47
[information] => 474
[about] => 747
[weibo] => 74444444444
[email] => 74444444444444444
[moblie] => 89742589633
[isfree] => y
[applytime] => 1349939108
)
)
------解決方案--------------------
LZ地址中參數apply前面多了個&符號,你看會不會是這個的問題