0
一個特定的值,我想知道我如何進入第三"value"
使用PHP在以下幾點:獲取JSON
"data": [
{
"id": "-",
"name": "-",
"period": "-",
"values": [
{
"value": 0,
"end_time": "2011-10-08T07:00:00+0000"
},
{
"value": 0,
"end_time": "2011-10-09T07:00:00+0000"
},
{
"value": 0,
"end_time": "2011-10-10T07:00:00+0000"
}
]
至於現在,我想要做的東西:
$results = json_decode(curl_exec ($curl));
但後來我堅持,因爲有3 "value"
內的"values"
,並告訴你,我很困惑的道理..
怎麼樣'$ results-> data-> values [2]'(object property,array)? – hakre
http://stackoverflow.com/questions/3076659/php-json-decode-get-a-value – rahularyansharma
使用'print_r()'或'var_dump()'來查看解碼的數組/對象是什麼樣的。你應該能夠解決如何從中訪問變量。 – Spudley