我有一个 php 文件,其中我试图获取我想在 html 表格中逐行打印的在线数据/股票报价,这是我的代码:
{
$url = 'http://download.finance.yahoo.com/d/quotes.csv?
s=^AORD+BHP.AX+BLT.L+AAPL&f=nd1l1';
$data = file_get_contents($url);
echo $data;
}
输出为:"ALL ORDINARIES","9/7/2017",5753.80 "BHP BLT FPO","9/7/2017",27.33 "BHP BILLITON PLC ORD $0.50","9/7/2017", 1457.50 "苹果公司","9/7/2017",161.26
我想要的是这样的:
"ALL ORDINARIES","9/7/2017",5753.80
"BHP BLT FPO","9/7/2017",27.33
"BHP BILLITON PLC ORD $0.50","9/7/2017",1457.50
"Apple Inc.","9/7/2017",161.26
我试着做:
echo $data[1];
但结果是:“A”
我应该如何解决这个问题?谢谢!