我从Valve那里找到了一个很棒的Steam API,我现在想知道如何逐一提供具体的信息.示例:$steam [‘response’] [‘players’] [‘personastate’].它不需要是那个解决方案.我刚输入一些东西:)
请求将如下所示:
{
"response": {
"players": [
{
"steamid": "{hidden}",
"communityvisibilitystate": 3,
"profilestate": 1,
"personaname": "nhagyavi",
"lastlogoff": 1317692549,
"commentpermission": 1,
"profileurl": "http:\/\/steamcommunity.com\/id\/nhagyavi\/",
"avatar": "http:\/\/media.steampowered.com\/steamcommunity\/public\/images\/avatars\/c2\/c25479aeea82f85eb1134bfcc8e064dcef1d361f.jpg",
"avatarmedium": "http:\/\/media.steampowered.com\/steamcommunity\/public\/images\/avatars\/c2\/c25479aeea82f85eb1134bfcc8e064dcef1d361f_medium.jpg",
"avatarfull": "http:\/\/media.steampowered.com\/steamcommunity\/public\/images\/avatars\/c2\/c25479aeea82f85eb1134bfcc8e064dcef1d361f_full.jpg",
"personastate": 1,
"realname": "Erik Edgren",
"primaryclanid": "103582791429525632",
"timecreated": 1106321372,
"gameserverip": "217.163.23.35:7777",
"gameextrainfo": "Red Orchestra 2: Heroes of Stalingrad",
"gameid": "35450",
"gameserversteamid": "90083758048089092",
"loccountrycode": "SE",
"locstatecode": "{hidden}",
"loccityid": {hidden}
}
]
}
}
我该如何解决?提前致谢!
最佳答案 看起来像JSON.你需要
json.decode
$json_object=
file_get_contents("http://api.steampowered.com/");
$json_decoded = json_decode($json_object);
//var_dump($json_decoded);
echo $json_decoded->response->players[0]->lastlogoff;
输出
1317711877