PHP children() 函数

定义和用法

children() 函数获取指定节点的子节点。

语法

class SimpleXMLElement
{
string children(ns,is_prefix)
}
参数 描述
ns 可选。
is_prefix 可选。默认是 false。

实例

XML 文件:



George
John
Reminder
Don't forget the meeting!

PHP 代码:

$xml->children() as $child)
  {
  echo "Child node: " . $child;
  }
?>

输出类似:

Child node: George
Child node: John
Child node: Reminder
Child node: Don't forget the meeting!