脚本宝典收集整理的这篇文章主要介绍了如何在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 ) ) ) ) )
请帮我.我尝试了很多东西,但没有正确的语法.
$xml是一个simplexml对象,你可以访问像
$xml->element.
它看起来像是时间输入的元素,在这种情况下你会像这样循环:
foreach( $xml->{'time-entry'} as $time_entry ) { echo $time_entry->description . "<br />\n"; }
以上是脚本宝典为你收集整理的如何在PHP中循环使用SimpleXML对象全部内容,希望文章能够帮你解决如何在PHP中循环使用SimpleXML对象所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。