【发布时间】:2018-02-16 18:35:45
【问题描述】:
我有一个 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 "Apple Inc. ","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];
但结果是: “一个”
我应该如何处理这个问题?谢谢!
【问题讨论】:
标签: php arrays json stocks asx