脚本宝典收集整理的这篇文章主要介绍了PHP从SimpleXMLElement数组中获取值,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
[1]=> object(SimpleXMLElement)#6 (1) { ["@attributes"]=> array(14) { ["name"]=> string(5) "MysqL" ["ackNowlEdged"]=> string(1) "1" ["comments"]=> string(1) "1" ["current_check_attempt"]=> string(1) "1" ["downtime"]=> string(1) "0" ["last_check"]=> string(19) "2010-05-01 17:57:00" ["markdown_filter"]=> string(1) "0" ["max_check_attempts"]=> string(1) "3" ["output"]=> string(42) "CRITical - Socket timeout after 10 seconds" ["PErfdata_available"]=> string(1) "1" ["service_object_id"]=> string(3) "580" ["state"]=> string(8) "critical" ["state_duration"]=> string(6) "759439" ["unhandled"]=> string(1) "0" } }
这是我的代码:
$xML = simplexml_load_string($results); foreach($xml->data->list as $child) { VAR_dump($child); echo $child->getName() . ": " . $child->name . "<br />"; }
以上是脚本宝典为你收集整理的PHP从SimpleXMLElement数组中获取值全部内容,希望文章能够帮你解决PHP从SimpleXMLElement数组中获取值所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。