simplexml_load_file()
当URL包含&符号时不加载XML文件。我已经尝试了两个例子有和无符号:使用simplexml_load_file在URL中出现问题
$source1 = simplexml_load_file("http://www.isws.illinois.edu/warm/data/outgoing/nbska/datastream.aspx?id=ncu");
print_r($source1); //works
$source2 = simplexml_load_file("http://forecast.weather.gov/MapClick.php?lat=38.8893&lon=-77.0494&unit=0&lg=english&FcstType=dwml");
print_r($source2); //no output
第一个例子效果很好,因为它不包括符号,但因为它包含符号的第二个例子是行不通的。
我参考了 simplexml_load_file with & (ampersand) in url with Solr和simplexml_load_file ampersand in url但它没有工作。