PHP getName() 函数
PHP 教程
· 2019-01-29 07:42:07
实例
返回 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>";
}
?>
$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();
技术细节
| 返回值: | 以字符串形式返回 SimpleXML 元素引用的 XML 标签的名称。 |
|---|---|
| PHP 版本: | 5.1.3+ |
点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html
Algorithms in C++
Robert Sedgewick / Addison-Wesley Professional / 1992-05-10 / USD 64.99
This version of Sedgewick's bestselling book provides a comprehensive collection of algorithms implemented in C++. The algorithms included cover a broad range of fundamental and more advanced methods:......一起来看看 《Algorithms in C++》 这本书的介绍吧!