xpath
在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 路徑。 |