我有这个 xml 对象,我想获取每个“p”$xml->query->search["p"][0]->attribute["title"],如何使用 foreach 获取每个对象?
SimpleXMLElement Object
(
[query] => SimpleXMLElement Object
(
[search] => SimpleXMLElement Object
(
[p] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[ns] => 0
[title] => Amebiasis
[timestamp] => 2013-09-16T16:11:24Z
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[ns] => 0
[title] => Entamoeba histolytica
[timestamp] => 2013-09-10T19:59:49Z
)
)
)
)
)
)