$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
)