0
<blink>
$xml = file_get_contents(http://weather.yahooapis.com/forecastrss?w=12797541);
$yahoo_response = new SimpleXMLElement($xml , 0, true);
</blink>
而且我得到了一個XML解析這樣的警告:
PHP Warning: SimpleXMLElement::__construct()
[<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]:
I/O warning : failed to load external entity "<?xml version="1.0"
.....
一個重要的部分消息是這樣的:
I/O warning : failed to load external entity
And I co üld不解析任何東西:
echo (string) $yahoo_response->rss->channel->item->title;
有沒有人知道如何解決這個問題或解決它?
謝謝, 亞歷克斯
那固定的錯誤和警告。謝謝。但是我怎麼仍然沒有從echo $ yahoo_response-> rss-> channel-> item-> title返回任何東西; – Genadinik 2011-02-24 08:04:01
我不確定(有一段時間沒有用過SimpleXML),但我相信'$ yahoo_response'指向' '元素。嘗試打印'$ yahoo_response-> channel-> item-> title'。你也應該看看手冊(http://lv.php.net/SimpleXMLElement)。 –
binaryLV
2011-02-24 08:12:34