可能重複:
php simplexml issue in reading an attribute that has a ‘column - : ’ in its name使用SimpleXML來抓住嵌套代碼
我在學習PHP的過程,所以我在做一個天氣應用程序顯示基於圖像關於天氣。我正在使用Yahoo Weather API。
我的問題是,我正在尋找一種方式來攫取the code of the weather, located next to yweather:condition。我發現simpleXML但無法弄清楚如何抓住東西是位於像雅虎確實它的XML在
<yweather:condition text="Fair" code="34" temp="37"
形式的方式所以我的問題是我怎麼能搶碼=「34」雅虎天氣的一部分,並顯示它像一個變量,如$weathercode = 34;
?
感謝任何及所有的幫助,我在這裏,如果你需要他們提供更多的細節!
此外,我不知道這文章的標題是正確的,很抱歉,如果它不是!
尋找http://stackoverflow.com/search?q=yweather+simplexml產生大量的成果。詢問前請使用搜索。謝謝。 – Gordon