PHP getNamespace() ຫົວຂໍ້ນັ້ນ

ການອະທິບາຍ ແລະ ການນໍາໃຊ້

getNamespace() ຫົວຂໍ້ນັ້ນຈະຮັບມາພັນພິມທີ່ນໍາໃຊ້ໃນເອັມເລັກຊີມ.

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

ຄຳນວຍພາກສ່ວນ

class SimpleXMLElement
{
string getNamespace(recursive)
)
ສະເພາະ ການອະທິບາຍ
recursive ທົດສະນະ. ຄົງຮູບວ່າຈະກັບຄືນມາທັງພັນພິມຂອງພັນພິມປະຈຳລັດ. ຄົງຮູບໂດຍຄົງການປະຈຸບັນ false.

ຕົວຢ່າງ

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->getNamespaces());
?>

ການອອກສຽງຄືກັນ:

Array
(
[b] => http://www.codew3c.com/example/
)