所以我有一个代码:
$user['steamid'] = "76561198350584156";
$inv = curl('https://steamcommunity.com/inventory/'.$user['steamid'].'/730/2?
l=english&count=5000');
$inv = json_decode($inv, true);
我得到了回复,例如:
Array
(
[assets] => Array
(
[0] => Array
(
[classid] => 1989373359
)
)
[descriptions] => Array
(
[0] => Array
(
[classid] => 1989373359
)
)
)
还有从[0]到例如[5]的数组,我怎样才能检查资产中的一个classid =来自描述的classid,我该如何检查呢?我正在做foreach(我想列出所有这些项目),但我需要来自资产和描述的这个classid。
答案 0 :(得分:0)
这是我前一段时间制作的一个小脚本:
$items = $data["rgDescriptions"];
foreach($items as $item) {
$image_url = "http://cdn.steamcommunity.com/economy/image/";
if($item["icon_url_large"]) {
$image_url = $item["icon_url_large"];
} else {
$image_url = $item["icon_url"];
}
$hash = str_replace("+", "%20", urlencode($item["market_hash_name"]));
if(substr($item["name"], 0, 4) == "Stat") echo " stattrack ";
echo $item["name"];
echo "<img src='http://cdn.steamcommunity.com/economy/image/" . $image_url . " ' height='42' width='42'/>";
echo "<br>";
}