「total_items」と「average_price」の数を選択するにはどうすればよいですか?デコードJSON(PHP)
JSON:私のPHPスクリプトザッツ
{
"status" : "success",
"data" : {
"items" : [
{
"market_hash_name" : "AK-47 | Redline (Field-Tested)",
"total_items" : 698,
"lowest_price" : "3.90",
"highest_price" : "300.00",
"cumulative_price" : "4669.62",
"recent_sales_info" : {
"hours" : "17.94",
"average_price" : "4.23"
}
}
]
}
}
:私は、変数に "TOTAL_ITEMS" の数と "average_price" を保存することができますどのように
$link = 'skin.json';
$string = file_get_contents($link);
$obj = json_decode($string, TRUE);
$name = $obj['items']['market_hash_name'];
$itmes = $name['total_items'];
$itmes = $name['average_price'];
? ありがとうございます よろしく。 エンゲ
$ obj ['data'] ['items'] [0] ['total_items'] 'と' $ obj ['data'] [ 'items'] [0] ['recent_sales_info '] [' average_price '] '。 – showdev