我有一个简单的脚本如下:
<?php
header('Content-Type: text/plain; charset=utf-8;');
$file = file_get_contents("http://weather.justcode.us/api.php?city=Suzhou");
print_r(json_decode($file));
?>
它返回
stdClass Object
(
[apiVersion] => 1.0
[data] => stdClass Object
(
[location] => Suzhou, CHN
[temperature] => 68
[skytext] => Clear
[humidity] => 60
[wind] => 13
[date] => 2013-05-04
[day] => Saturday
)
)
我如何打印(例如)数据->位置或数据->日期?哦,如果这是一个简单的问题,请提前道歉。