[英]Steam Api Json to PHP
sorry for my bad english. 对不起,我的英语不好。
I want convert steamapi (json) to php variables. 我想将steamapi(json)转换为php变量。 How can i do that?
我怎样才能做到这一点?
I'm using this code: 我正在使用此代码:
$api = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=5E78FFBEBC11204E33F589AA5E027F82&steamids=76561197960435530"; $json = file_get_contents($api); $decoded = json_decode($json); print_r($decoded->{'response'}->{'players'}->{'steamid'});
I want show the steamid. 我想证明一下。
Try this 尝试这个
print_r($decoded->response->players[0]->steamid);
players is an array, so you must take its first element. 玩家是一个数组,因此您必须采用其第一个元素。
It doesn't work json_decode? json_decode不起作用吗? This should work you have the json in $decoded.
如果您在$ decoded中拥有json,这应该可以工作。 If you want steamid you have to do this:
如果您想汽化,则必须执行以下操作:
$obj->{'steamid'};
I hope this can help you. 希望对您有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.