-3
<?php
$data = file_get_contents("http://query.yahooapis.com/v1/public/yql?env=http%3A%2F%2Fdatatables.org%2Falltables.env&format=json&q=select%20*%20from%20yahoo.finance.historicaldata%20where%20startDate=%272014-01-01%27%20and%20endDate=%272014-01-10%27%20and%20symbol=%27YHOO%27");
$myArray = json_decode($data, true);
/*
echo "<pre>";
var_dump($myArray);
echo "</pre>";
*/
echo $myArray['query']['results']['quote'][0]['Close']," DayX";
?>
我可以讀出在第一天的關閉數。
- >我如何讀出'Close'的所有條目? - >在本例中是:
echo $myArray['query']['results']['quote'][0]['Close']," Day1";
echo $myArray['query']['results']['quote'][1]['Close']," Day2";
echo $myArray['query']['results']['quote'][2]['Close']," Day3";
...
echo $myArray['query']['results']['quote'][6]['Close']," Day7";
http://php.net/manual/en/control-structures.foreach.php ??? – AbraCadaver