PHP children() º¯Êý
¶¨ÒåºÍÓ÷¨
children() º¯Êý»ñȡָ¶¨½ÚµãµÄ×ӽڵ㡣
Óï·¨
class SimpleXMLElement
{
string children(ns,is_prefix)
}
| ²ÎÊý | ÃèÊö |
|---|---|
| ns | ¿ÉÑ¡¡£ |
| is_prefix | ¿ÉÑ¡¡£Ä¬ÈÏÊÇ false¡£ |
Àý×Ó
XML Îļþ£º
<?xml version="1.0" encoding="ISO-8859-1"?> <note> <to>George</to> <from>John</from> <heading>Reminder</heading> <body>Don't forget the meeting!</body> </note>
PHP ´úÂ룺
<?php
$xml = simplexml_load_file("test.xml");
foreach ($xml->children() as $child)
{
echo "Child node: " . $child;
}
?>
Êä³öÀàËÆ£º
Child node: George Child node: John Child node: Reminder Child node: Don't forget the meeting!