所以我遇到以下代码的问题。
我已将CURLOPT_RETURNTRANSFER
设置为true
,但在curl_exec
被点击时未返回任何内容。任何和所有的帮助表示赞赏!
<?php
$yql_base_url = "http://query.yahooapis.com/v1/public/yql?q=";
$yql_query = "select * from csv where url='http://download.finance.yahoo.com/d/quotes.csv?s=YHOO,GOOG,AAPL&f=sl1d1t1c1ohgv&e=.csv' and columns='symbol,price,date,time,change,col1,high,low,col2'";
$yql_params = "&format=json&diagnostics=true&callback=";
$yql_url = $yql_base_url . urlencode($yql_query) . $yql_params;
$session = curl_init($yql_url);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$json = curl_exec($session);
curl_close($session);
$phpObj = json_decode($json);
if(!is_null($phpObj->query->results))
{
echo $phpObj->query->results;
}
?>
答案 0 :(得分:0)
$phpObj->query->results
是一个Object数组,您无法对其进行echo
。只需在其上使用print_r()
或var_dump()
。
示例:
print_r($phpObj->query->results);
var_dump($phpObj->query->results);