从数组json解码
如何解码特定URL上JSON数组中的值从数组json解码,json,url,decode,Json,Url,Decode,如何解码特定URL上JSON数组中的值 array(8) { ["name"]=> string(18) "Server for testing" ["map"]=> string(12) "pointlessMap" ["game"]=> string(4) "game" ["description"]=> string(12) "No desc. set" ["players"]=> int(5) ["playersmax"]=> int(1
array(8)
{
["name"]=> string(18) "Server for testing"
["map"]=> string(12) "pointlessMap"
["game"]=> string(4) "game"
["description"]=> string(12) "No desc. set"
["players"]=> int(5)
["playersmax"]=> int(100)
["password"]=> int(0
["vac"]=> int(1)
}
我试着解码玩家:
<?php
$json = file_get_contents('http://url here/index.php');
$obj = json_decode($json);
echo $obj->array[5]->players;
?>
我需要解码“玩家”,谢谢您的帮助。echo的输出是什么??它是空的…..请尝试使用此选项,而不是
echo
语句print\r($obj)代码>那么它说什么?