打印SimpleXMLElement对象

时间:2012-10-05 13:40:52

标签: php simplexml printf

我有一个像这样的SimpleXMLElement:

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

我现在已经谷歌了两个小时,但却找不到如何打印“trailer_id”。 有人能指出我正确的方向吗?

1 个答案:

答案 0 :(得分:1)

它们是对象,请尝试:

echo $xml->trailer->trailer_id;
相关问题