<?php
$xml = simplexml_load_file("sample.xml");
echo " ". $xml->getName() . "<br />";
foreach($xml->children()->children() as $child)
{
$a=$child->getName() . "<br />";
array_push($a);
echo $a;
}
?>
答案 0 :(得分:0)
试试这个
<?php
$arr = array();
$xml = simplexml_load_file("sample.xml");
echo " ". $xml->getName() . "<br />";
foreach($xml->children()->children() as $child)
{
$a=$child->getName() . "<br />";
$arr[] = $a;
echo $a;
}
?>