【发布时间】:2016-05-22 00:10:05
【问题描述】:
这是我的 json
{
"rgInventory": {
"5455029633": {
"id":"5455029633",
"classid":"310776543",
"instanceid":"302028390",
"amount":"1"
}
}
}
这是我在php中解析json的方式
$content = file_get_contents("http://steamcommunity.com/profiles/76561198201055225/inventory/json/730/2");
$decode = json_decode($content);
foreach($decode->rgInventory->5455029633 as $appid){
echo $appid->id;
}
我需要得到那个 5455029633,但它在 foreach 中不起作用。
我也想将它存储在变量中。
【问题讨论】: