DOMNode::lookupNamespaceURI
(PHP 5, PHP 7, PHP 8)
DOMNode::lookupNamespaceURI — Gets the namespace URI of the node based on the prefix
说明
Gets the namespace URI of the node based on the
prefix
.
参数
prefix
-
The prefix to look for. If this parameter is
null
, the method will return the default namespace URI, if any.
返回值
Returns the associated namespace URI or null
if none is found.
+添加备注
用户贡献的备注 2 notes
lewar ¶
17 years ago
Simple way to get the URI of the default namespace:
<?php
$document = new DOMDocument();
$document->load($xml_file);
$uri = $document->documentElement->lookupnamespaceURI(NULL);
?>
备份地址:http://www.lvesu.com/blog/php/domnode.lookupnamespaceuri.php