简单的XML名称空间警告

use*_*359 6 php namespaces simplexml

我试图使用simplexml解析以下XML ...

http://datapoint.metoffice.gov.uk/public/data/txt/wxfcs/regionalforecast/xml/500?key=ed47ad61-5033-48c8-bf7c-6c4c0b17c3f3

但是一旦我添加了这条线......

$xml = simplexml_load_file('http://datapoint.metoffice.gov.uk/public/data/txt/wxfcs/regionalforecast/xml/500?key=ed47ad61-5033-48c8-bf7c-6c4c0b17c3f3');
Run Code Online (Sandbox Code Playgroud)

我得到了错误

namespace warning : xmlns: URI www.metoffice.gov.uk/xml/metoRegionalFcst is not absolute
Run Code Online (Sandbox Code Playgroud)

我似乎无法解决如何解决这个问题.

小智 9

只需在simplexml_load_file之前添加@

喜欢

$ xml = @simplexml_load_file(' http://datapoint.metoffice.gov.uk/public/data/txt/wxfcs/regionalforecast/xml/500?key=ed47ad61-5033-48c8-bf7c-6c4c0b17c3f3 ');