我现在正在看某人的清单
$inventory = file_get_contents("http://steamcommunity.com/profiles/{$Steam64}/inventory/json/730/2");
这是模拟到
file_get_contents("http://api.steampowered.com/ISteamUser/GetplayerSummaries/v0002/?key={$api}&steamids={$Steam64}");
在这里我得到了steamid64
{$steam->response->players[0]->personaname}
如何在清单的.json
中获取特定元素?例如:
{"success":true,"rgInventory":{"5904013658":{"id":"5904013658","classid":"469437901","instanceid":"302028390","amount":"1","pos":1},"5903531561":{"id":"5903531561","classid":"1293508920","instanceid":"0","amount":"1","pos":2},"5175566083":{"id":"5175566083","classid":"310780331","instanceid":"302028390","amount":"1","pos":3}
如何获得分类?我上面的解决方案不适用于此:-(
我也需要读一读:
pos":22}},"rgCurrency":[],"rgDescriptions":{"469437901_302028390":{"appid":"730","classid":"469437901","instanceid":"302028390","icon_url":"-9a81dlWLwJ2UUGcV
这一部分中的icon_url和其他内容。
问候
发布于 2016-04-27 02:59:22
您的响应似乎是JSON,请尝试如下所示:
$inventory = file_get_contents("http://steamcommunity.com/profiles/{$Steam64}/inventory/json/730/2");
$response = json_decode($inventory, true);
这将返回您可以轻松访问的关联数组。例如$response['...']['...']
https://stackoverflow.com/questions/36873049
复制相似问题