主页
PHP
PHP getName() 函数
demo_func_simplexml_getname
运行 ❯
×
更改方向
保存代码
更改主题
<?php $xml=<<
Volvo
BMW
Saab
XML; $sxe=new SimpleXMLElement($xml); // Get the name of the cars element echo $sxe->getName() . "
"; // Also print out the names of the children of the cars element foreach ($sxe->children() as $child) { echo $child->getName() . "
"; } ?>