PHP getChildren() လုပ်ဆောင်ချက်
ဥပမာ
လက်ရှိဒြပ်စင်၏ ကလေးဒြပ်စင်များကို ရယူပြီး အမည်နှင့် ဒေတာကို ထုတ်ပေးပါ-
<?php
$bookxml = <<<XML
<bookstore>
<book>
<title>Everyday Italian</title>
<author>Giada De
Laurentiis</author>
</book>
<book>
<title>Harry Potter</title>
<author>J K.
Rowling</author>
</book>
<book>
<title>Learning XML</title>
<author>Erik T. Ray</author>
</book>
</bookstore>
XML;
$xml = new SimpleXMLIterator($bookxml);
for( $xml->rewind(); $xml->valid(); $xml->next() ) {
foreach($xml->getChildren()
as $name => $data) {
echo "The $name is '$data'";
echo "<br>";
}
}
?>
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
getChildren() လုပ်ဆောင်ချက်သည် လက်ရှိဒြပ်စင်၏ ကလေးဒြပ်စင်များကို ပြန်ပေးသည်။
အထားအသို
SimpleXMLIterator::getChildren()
နည်းပညာဆိုင်ရာအသေးစိတ်
ပြန်ပို့တန်ဖိုး- | လက်ရှိဒြပ်စင်၏ကလေးများပါရှိသော SimpleXMLIterator အရာဝတ္ထု |
---|---|
PHP ဗားရှင်း- | 5.0+ |
❮ PHP SimpleXML အကိုးအကား