PHP getDocNamespaces() º¯Êý

¶¨ÒåºÍÓ÷¨

getDocNamespaces() º¯Êý´Ó SimpleXMLElement ¶ÔÏó·µ»ØÔÚ XML ÎĵµÖÐÉùÃ÷µÄÃüÃû¿Õ¼ä¡£

Èç¹û³É¹¦£¬¸Ãº¯Êý·µ»Ø°üº¬ÃüÃû¿Õ¼äÃû³Æ£¨´øÓйØÁªµÄ URL£©µÄÊý×é¡£Èç¹ûʧ°Ü£¬Ôò·µ»Ø false¡£

Óï·¨

class SimpleXMLElement
{
string getDocNamespaces(recursive)
}
²ÎÊý ÃèÊö
recursive ¿ÉÑ¡¡£¹æ¶¨ÊÇ·ñ·µ»Ø¸¸×Ó½ÚµãÖеÄËùÓÐÃüÃû¿Õ¼ä¡£Ä¬ÈÏÊÇ false¡£

Àý×Ó

XML Îļþ£º

<?xml version="1.0" encoding="ISO-8859-1"?>
<note xmlns:b="http://www.w3school.com.cn/example/">
<to>George</to>
<from>John</from>
<heading>Reminder</heading>
<b:body>Don't forget the meeting!</b:body>
</note>

PHP ´úÂ룺

<?php
if (file_exists('test.xml'))
  {
  $xml = simplexml_load_file('test.xml');
  }

print_r($xml->getDocNamespaces());
?>

Êä³öÀàËÆ£º

Array
(
[b] => http://www.w3school.com.cn/example/
)
VUE