PHP getName() İşlevi
Örnek
XML öğesinin ve alt öğelerin adını döndürün:
<?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);
// Get the name of the cars element
echo $sxe->getName() . "<br>";
// Also print out the names of the children of the cars element
foreach ($sxe->children() as $child)
{
echo $child->getName() . "<br>";
}
?>
Tanım ve Kullanım
getName() işlevi, XML öğesinin adını döndürür.
Sözdizimi
SimpleXMLElement::getName()
Teknik detaylar
Geri dönüş değeri: | Bir dize olarak XML öğesinin adı |
---|---|
PHP Sürümü: | 5.1.3+ |
❮ PHP SimpleXML Referansı