0514-86177077
9:00-17:00(工作日)
PHP children() 函數
實例
查找 note 節點的子節點:
?php $note=XML note> to>Tove/to> from>Jani/from> heading>Reminder/heading> body>Don't forget me this weekend!/body> /note> XML; $xml=simplexml_load_string($note); foreach ($xml->children() as $child) { echo "Child node: " . $child . "br>"; } ?>
定義和用法
children()函數查找指定節點的子節點。
children()
語法
children( _ns,is_prefix_ );
實例 1
查找 body 節點的子節點:
?php $note=XML note> to>Tove/to> from>Jani/from> heading>Reminder/heading> body>span>Important!/span> Don't forget me this weekend!/body> /note> XML; $xml=simplexml_load_string($note); foreach ($xml->body[0]->children() as $child) { echo "Child node: " . $child . "br>"; } ?>
總結
以上就是這篇文章的全部內容了,希望本文的內容對大家的學習或者工作具有一定的參考學習價值,謝謝大家對腳本之家的支持。如果你想了解更多相關內容請查看下面相關鏈接
標簽:遂寧 遵義 寧夏 吐魯番 武威 常州 徐州 荊門
上一篇:PHP attributes()函數講解
下一篇:PHP registerXPathNamespace()函數講解
Copyright ? 1999-2012 誠信 合法 規范的巨人網絡通訊始建于2005年
蘇ICP備15040257號-8