Wie kann ich die Anzahl von "total_items" und "average_price" auswählen?Decode JSON (PHP)
JSON:
{
"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"
}
}
]
}
}
Das ist mein PHP-Script:
$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'];
Wie kann ich die Anzahl der "TOTAL_ITEMS" und die "average_price" in Variablen speichern? Danke Grüße. Enge
Es scheint, dass du auf $ obj ['data'] ['items'] [0] ['total_items'] 'und' $ obj ['data'] zugreifen würdest. 'Artikel'] [0] ['recent_sales_info '] [' durchschnittlicher_preis '] '. – showdev