PHP函数children介绍
定义和用法
children() 函数获取指定节点的子节点。
语法
class SimpleXMLElement{string children(ns,is_prefix)}
例子
XML 文件:
<?xml version="1.0" encoding="ISO-8859-1"?><note><to>George</to><from>John</from><heading>Reminder</heading><body>Dont forget the meeting!</body></note>
PHP 代码:
<?php$xml = simplexml_load_file("test.xml");foreach ($xml->children() as $child) { echo "Child node: " . $child; }?>
输出类似:
Child node: GeorgeChild node: JohnChild node: ReminderChild node: Dont forget the meeting!
本文出自:琅枫个人博客。如需转载请注明出处!
本文出处:"https://www.langfujun.top/function/444.html"
如果您觉得文章对你有帮助,可以进行打赏。
打赏多少,您高兴就行,谢谢您对琅枫博客的支持! ~(@^_^@)~
微信打赏

支付宝打赏
