2013-05-08 37 views
0

試圖將雅虎股票供稿添加到我的網站。我能得到的價格顯示,但只打印時,我想的是價格ASX股票供稿 - 顯示陣列不能刪除

這是在WordPress

function getStock($quote='GOOG') 
{ 
$file = "http://download.finance.yahoo.com/d/quotes.csv?s=$quote.AX&f=l1"; 
$handle = fopen($file, "r"); 
while($data = fgetcsv($handle, 4096, ',')) 
    print_r($data);  
fclose($handle); 
} 

功能有些unneccassary的文字,這就是它輸出

Array ( 
    [0] => 0.110 
) 

它幾乎在那裏,只需要刪除除0.110之外的其他零售商

回答

3

替換print_r($data)

$d = array_shift($data); print_r($d); 
+0

謝謝,工作完美 – strohy85 2013-05-08 06:32:07