PHP xpath() İşlevi
Örnek
XML belgesinde bir XPath sorgusu çalıştırın:
<?php
$note=<<<XML
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Do not forget me this weekend!</body>
</note>
XML;
$xml = new SimpleXMLElement($note);
$result = $xml->xpath("/note/to");
print_r($result);
?>
Tanım ve Kullanım
xpath() işlevi, XML belgesinde bir XPath sorgusu çalıştırır.
Sözdizimi
SimpleXMLElement::xpath(path)
Parametre Değerleri
Parameter | Description |
---|---|
path | Required. Specifies an XPath path to use |
Teknik detaylar
Geri dönüş değeri: | Başarıyla ilgili bir dizi SimpleXMLElements. Başarısızlıkta YANLIŞ |
---|---|
PHP Sürümü: | 5.0+ |
❮ PHP SimpleXML Referansı