PHP getName() 函数
实例
返回 XML 元素及其子元素的名称:
<?php $xml=<<<XML <?xml version="1.0" standalone="yes"?> <cars> <car id="1">Volvo</car> <car id="2">BMW</car> <car id="3">Saab</car> </cars> XML; $sxe=new SimpleXMLElement($xml); echo $sxe->getName() . "<br>"; foreach ($sxe->children() as $child) { echo $child->getName() . "<br>"; } ?>
定义和用法
getName()
函数返回 XML 元素的名称。
语法
getName();
总结
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对华域联盟的支持。如果你想了解更多相关内容请查看下面相关链接
您可能感兴趣的文章:
- PHP bin2hex()函数基础实例讲解
- PHP xpath()函数讲解
- PHP addcslashes()函数讲解
- PHP addslashes()函数讲解
- PHP simplexml_load_string()函数实例讲解
- PHP simplexml_load_file()函数讲解
- PHP simplexml_import_dom()函数讲解
- PHP count()函数讲解
- PHP getDocNamespaces()函数讲解
- PHP chop()函数讲解
本文由 华域联盟 原创撰写:华域联盟 » PHP getName()函数讲解
转载请保留出处和原文链接:https://www.cnhackhy.com/53183.htm