2012-10-05 112 views
-2

我有這樣一個SimpleXMLElement:打印SimpleXMLElement對象

SimpleXMLElement Object ([trailer] => SimpleXMLElement Object (
[title] => This is the title 
[link] => http://example.com 
[trailer_id] => 60373 
[embed] => SimpleXMLElement Object ())) 

我現在一個谷歌兩小時,也找不到如何打印的「trailer_id」。 有人能指出我正確的方向嗎?

+1

有趣,你用什麼樣的文本,而搜索這一點。 – Leri

+0

你介意發佈原始XML嗎? –

+0

兩個小時? ':○)'。剛剛找到[this](http://stackoverflow.com/questions/1133931/getting-actual-value-from-php-simplexml-node),看起來非常有幫助。 – halfer

回答

1

他們都是對象,嘗試:

echo $xml->trailer->trailer_id; 
+0

謝謝,工作像魅力。 – 3und80