从openweathermap获取天气数据失败。这里是我的代码:将XML数据解析为PHP变量
$xml = new
SimpleXMLElement(file_get_contents('http://api.openweathermap.org/data/2.5/weather?q=london&mode=xml'));
$country = $xml->code->country;
$city = $xml->code->city;
echo "Country: $country<br/>City: $city";
当我回声我什么也没有得到。帮助表示赞赏!
这个问题似乎是题外话,因为它缺乏的故障排除一个错字基本的了解。 – hakre
可能的重复:[如何在PHP中获取有用的错误消息?](http://stackoverflow.com/q/845021/367456) – hakre