[請益] json_decode後的資料如何使用?
$content = file_get_contents($siteurl);
$data = json_decode($content);
echo $data[0]->title." ".$data[0]->showinfo[0]->time;
資料都出不來,是用法有錯誤嗎?
用print_r顯示$data的結果(只貼上第一筆)
Array
(
[0] => stdClass Object
(
[version] => 1.4
[UID] => 526aa481e44da0ea8d4168c4
[title] => 2014TIFA-拉布蘭之心人聲音樂會
[category] => 1
[showInfo] => Array
(
[0] => stdClass Object
(
[time] => 2014/03/07 19:30:00
[location] => 台北市中山南路21-1號
[locationName] => 國家演奏廳
[onSales] => Y
[price] => 400,500
[latitude] => 25.0348366
[longitude] => 121.5176314
)
[1] => stdClass Object
(
[time] => 2014/03/08 19:30:00
[location] => 台北市中山南路21-1號
[locationName] => 國家演奏廳
[onSales] => Y
[price] => 400,500
[latitude] => 25.0348366
[longitude] => 121.5176314
)
)
[showUnit] =>
[discountInfo] =>
[descriptionFilterHtml] =>
[imageUrl] =>
[masterUnit] => Array
(
[0] => 國立中正文化中心
)
[subUnit] => Array
(
[0] =>
)
[supportUnit] => Array
(
[0] =>
)
[otherUnit] => Array
(
[0] => 主要藝文支持:JTI
)
[webSales] =>
http://www.artsticket.com.tw/CKSCC2005/Product/Product00/ProductsDetailsPage.aspx?ProductID=oK4bYlG1GfzBcHkQto2QJ
[sourceWebPromote] => http://tifa.ntch.edu.tw/
[comment] =>
[editModifyDate] => 2013/10/28 14:46:13
[sourceWebName] => 兩廳院售票網
[startDate] => 2014/03/07
[endDate] => 2014/03/08
[status] => success
[total] => 111
)
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.124.108.82
→
03/10 10:19, , 1F
03/10 10:19, 1F
→
03/10 10:31, , 2F
03/10 10:31, 2F
→
03/10 10:45, , 3F
03/10 10:45, 3F
→
03/10 10:45, , 4F
03/10 10:45, 4F
→
03/10 10:46, , 5F
03/10 10:46, 5F
→
03/10 11:01, , 6F
03/10 11:01, 6F
→
03/10 11:02, , 7F
03/10 11:02, 7F
推
03/10 11:22, , 8F
03/10 11:22, 8F
→
03/10 11:22, , 9F
03/10 11:22, 9F
→
03/10 11:23, , 10F
03/10 11:23, 10F
→
03/10 11:25, , 11F
03/10 11:25, 11F
推
03/10 11:31, , 12F
03/10 11:31, 12F
→
03/10 11:31, , 13F
03/10 11:31, 13F
→
03/10 11:32, , 14F
03/10 11:32, 14F
→
03/10 11:34, , 15F
03/10 11:34, 15F
推
03/10 13:03, , 16F
03/10 13:03, 16F
→
03/10 13:04, , 17F
03/10 13:04, 17F
→
03/10 13:04, , 18F
03/10 13:04, 18F
推
03/10 13:24, , 19F
03/10 13:24, 19F
→
03/10 17:48, , 20F
03/10 17:48, 20F