我有一個simpleXml對象,並希望從該對象中讀取數據,我是PHP新手,不太瞭解如何執行此操作。對象細節如下。如何循環訪問PHP中的SimpleXML對象
我需要閱讀[說明]和[小時]。謝謝。
SimpleXMLElement Object (
[@attributes] => Array (
[type] => array
)
[time-entry] => Array (
[0] => SimpleXMLElement Object (
[date] => 2010-01-26
[description] => TCDM1 data management: sort & upload
[hours] => 1.0
[id] => 21753865
[person-id] => 350501
[project-id] => 4287373
[todo-item-id] => SimpleXMLElement Object (
[@attributes] => Array (
[type] => integer
[nil] => true
)
)
)
[1] => SimpleXMLElement Object (
[date] => 2010-01-27
[description] => PDCH1: HTML
[hours] => 0.25
[id] => 21782012
[person-id] => 1828493
[project-id] => 4249185
[todo-item-id] => SimpleXMLElement Object (
[@attributes] => Array (
[type] => integer
[nil] => true
)
)
) ) )
請幫助我。我嘗試了很多東西,但沒有得到正確的語法。
非常感謝,他們工作得很好。 你們搖滾, 再次感謝... – Aditya 2010-05-25 17:20:06