ຫົວຂໍ້ PHP getDocNamespaces() ຟັງການ

ການກໍານົດ ແລະ ການນໍາໃຊ້

getDocNamespaces() ຫົວຂໍ້ຕອນຈຳນວນທີ່ມີຊື່ນຳຊົວຊັ້ນຈາກ SimpleXMLElement ໃນ XML ບັນຊີ.

ຖ້າປະສົບຜົນສຳເລັດ, ຫົວຂໍ້ຕອນຈຳນວນທີ່ມີຊື່ນຳຊົວຊັ້ນ (ກັບທາງເຂົ້າຫາ URL) ຈະມີອີກອັນ. ຖ້າບໍ່ປະສົບຜົນ, ຈະມີຄວາມຜິດຫວັງ false.

ວິທະຍາສາດ

class SimpleXMLElement
{
string getDocNamespaces(recursive)
)
ມາດຕະການ ການອະທິບາຍ
recursive ທົດສະນະ. ກໍານົດວ່າຈະກັບຄືນມາຕົວຈາກພັກຂອງພັກພີມປະຈຳພັກພີມ. ການລະບຸຄືນມາຕົວເປັນຄົນທີ່ຜິດຕາມຄົນທີ່ຜິດ.

ຄວາມຄິດ

XML ບັນຊີ:

<?xml version="1.0" encoding="ISO-8859-1"?>
<note xmlns:b="http://www.codew3c.com/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.codew3c.com/example/
)