當前位置: 首頁> 函數類別大全> xpath

xpath

在XML 數據上運行XPath 查詢。
名稱:xpath
分類:未分類
所屬語言:php
一句話介紹:在XML 數據上運行XPath 查詢。

定義和用法

xpath()函數在XML 文檔上運行XPath 查詢。

實例

在XML 文檔上運行XPath 查詢:

 <?php
$note = <<< XML
<note>
<to>George</to>
<from>John</from>
<heading>Reminder</heading>
<body>Do not forget the meeting!</body>
</note>
XML ;

$xml = new SimpleXMLElement ( $note ) ;

$result = $xml -> xpath ( "/note/to" ) ;

print_r ( $result ) ;
?>

運行實例

文法

SimpleXMLElement :: xpath ( path )
參數 描述
path 必需。指定要使用的XPath 路徑。
同類函數
熱門文章