【发布时间】:2014-04-15 02:43:23
【问题描述】:
当我尝试使用
从 API 获取数据时file_get_contents("http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.xchange%20where%20pair%20in%20(%22USDINR%22)&format=json&env=store://datatables.org/alltableswithkeys&callback=");
我得到了一个字符串的结果。有没有办法将它转换回数组? 我得到的字符串是
string(202) "{"query":{"count":1,"created":"2014-03-11T13:00:31Z","lang":"en-US","results":{"rate":{"id":"USDINR","Name":"USD to INR","Rate":"60.99","Date":"3/11/2014","Time":"9:00am","Ask":"61.00","Bid":"60.98"}}}}"{"error":"","msg":""}
请帮帮我....
【问题讨论】:
-
是的。 php.net/json_decode(设置第二个参数为
TRUE获取数组)
标签: php arrays file-get-contents