從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