PHP ကျူတိုရီရယ်

PHP ပင်မစာမျက်နှာ PHP မိတ်ဆက် PHP ထည့်သွင်းပါ။ PHP Syntax PHP မှတ်ချက်များ PHP Variables များ PHP Echo / Print PHP Data အမျိုးအစားများ PHP စာတန်းများ PHP နံပါတ်များ PHP သင်္ချာ PHP Constants PHP Operator များ PHP If...Else...Elseif PHP Switch PHP Loops PHP လုပ်ဆောင်ချက်များ PHP Arrays PHP Superglobals PHP RegEx

PHP Forms

PHP Form ကိုင်တွယ်ခြင်း။ PHP Form Validation PHP Form လိုအပ်ပါသည်။ PHP Form URL/E-mail PHP Form ပြီးပါပြီ။

PHP အဆင့်မြင့်

PHP နေ့စွဲနှင့် အချိန် PHP ပါဝင်ပါတယ်။ PHP ဖိုင်ကိုင်တွယ်ခြင်း PHP ဖိုင်ကို ဖွင့်/ဖတ်ပါ။ PHP ဖိုင်ကို ဖန်တီး/ရေးပါ။ PHP ဖိုင်ကို တင်ခြင်း။ PHP Cookies PHP စက်ရှင်များ PHP Filters PHP Filters Advanced PHP ပြန်ခေါ်ခြင်းလုပ်ဆောင်ချက်များ PHP JSON PHP ခြွင်းချက်

PHP OOP

PHP OOP ဆိုတာဘာလဲ PHP အတန်းများ/အရာဝတ္ထုများ PHP Constructor PHP Destructor PHP Access Modifiers PHP Inheritance PHP Constants PHP Abstract အတန်းများ PHP မျက်နှာပြင်များ PHP လက္ခဏာများ PHP Static Methods PHP Static Properties PHP Namespaces PHP Iterables

MySQL ဒေတာဘေ့စ်

MySQL ဒေတာဘေ့စ် MySQL ချိတ်ဆက်မှု MySQL သည် DB ကိုဖန်တီးပါ။ MySQL ဇယားဖန်တီးပါ။ MySQL သည် Data ကိုထည့်သွင်းပါ။ MySQL နောက်ဆုံး ID ကိုရယူပါ။ MySQL တွင် Multiple ထည့်သွင်းပါ။ MySQL ပြင်ဆင်ထားသည်။ MySQL Data ကို ရွေးပါ။ MySQL ဘယ်မှာလဲ။ MySQL Order By MySQL က Data တွေကို ဖျက်လိုက်ပါ။ MySQL အပ်ဒိတ်ဒေတာ MySQL ကန့်သတ်ဒေတာ

PHP XML

PHP XML ပါဆာများ PHP SimpleXML Parser PHP SimpleXML - ရယူပါ။ PHP XML Expat PHP XML DOM

PHP - AJAX

AJAX နိဒါန်း AJAX PHP AJAX ဒေတာဘေ့စ် AJAX XML AJAX တိုက်ရိုက်ရှာဖွေမှု AJAX စစ်တမ်း

PHP ဥပမာများ

PHP ဥပမာများ PHP Compiler PHP Quiz PHP လေ့ကျင့်ခန်းများ PHP Certificate

PHP အ ကိုးအကား

PHP ခြုံငုံသုံးသပ်ချက် PHP Array PHP ပြက္ခဒိန် PHP နေ့စွဲ PHP လမ်းညွှန် PHP အမှား PHP ခြွင်းချက် PHP ဖိုင်စနစ် PHP Filter PHP FTP PHP JSON PHP သော့ချက်စာလုံးများ PHP Libxml PHP Mail PHP သင်္ချာ PHP ထွေ PHP MySQLi PHP ကွန်ရက် PHP Output Control PHP RegEx PHP SimpleXML PHP Stream PHP String PHP Variable ကိုင်တွယ်ခြင်း။ PHP XML Parser PHP Zip PHP အချိန်ဇုန်များ

PHP simplexml_load_file() လုပ်ဆောင်ချက်

❮ PHP SimpleXML အကိုးအကား

ဥပမာ

XML ဖိုင်ကို အရာဝတ္ထုအဖြစ်သို့ ပြောင်းပါ၊ ထို့နောက် အရာဝတ္တု၏ သော့များနှင့် အစိတ်အပိုင်းများကို ထုတ်ပေးပါ-

<?php
$xml=simplexml_load_file("note.xml");
print_r($xml);
?>

အဓိပ္ပါယ်နှင့် အသုံးပြုမှု

simplexml_load_file() လုပ်ဆောင်ချက်သည် XML စာရွက်စာတမ်းကို အရာဝတ္ထုတစ်ခုအဖြစ်သို့ ပြောင်းပေးသည်။


အထားအသို

simplexml_load_file(file, class, options, ns, is_prefix)

ကန့်သတ်တန်ဖိုးများ

Parameter Description
file Required. Specifies the path to the XML file
class Optional. Specifies the class of the new object
options Optional. Specifies additional Libxml parameters. Is set by specifying the option and 1 or 0 (TRUE or FALSE, e.g. LIBXML_NOBLANKS(1))

Possible values:

  • LIBXML_COMPACT - Activate nodes allocation optimization (may speed up application)
  • LIBXML_DTDATTR - Set default DTD attributes
  • LIBXML_DTDLOAD - Load external subset
  • LIBXML_DTDVALID - Validate with the DTD
  • LIBXML_NOBLANKS - Remove blank nodes
  • LIBXML_NOCDATA - Merge CDATA as text nodes
  • LIBXML_NOEMPTYTAG - Expand empty tags (e.g. <br/> to <br></br>), only available in the DOMDocument->save() and DOMDocument->saveXML() functions
  • LIBXML_NOENT - Substitute entities
  • LIBXML_NOERROR - Do not show error reports
  • LIBXML_NONET - Disable network access while loading documents
  • LIBXML_NOWARNING - Do not show warning reports
  • LIBXML_NOXMLDECL - Drop the XML declaration when saving a document
  • LIBXML_NSCLEAN - Remove redundant namespace declarations
  • LIBXML_PARSEHUGE - Sets XML_PARSE_HUGE flag, which relaxes any hardcoded limit from the parser. This affects limits like maximum depth of a document and limits of the size of text nodes
  • LIBXML_XINCLUDE - Implement XInclude substitution
  • LIBXML_ERR_ERROR - Get recoverable errors
  • LIBXML_ERR_FATAL - Get fatal errors
  • LIBXML_ERR_NONE - Get no errors
  • LIBXML_ERR_WARNING - Get simple warnings
  • LIBXML_VERSION - Get libxml version (e.g. 20605 or 20617)
  • LIBXML_DOTTED_VERSION - Get dotted libxml version (e.g. 2.6.5 or 2.6.17)
ns Optional. Specifies a namespace prefix or URI
is_prefix Optional. Specifies a Boolean value. TRUE if ns is a prefix. FALSE if ns is a URI. Default is FALSE


နည်းပညာဆိုင်ရာအသေးစိတ်

ပြန်ပို့တန်ဖိုး- အောင်မြင်မှုအပေါ် SimpleXMLElement အရာဝတ္ထု။ ရှုံးနိမ့်မှုအပေါ် မှားသည်။
PHP ဗားရှင်း- ၅+

နောက်ထပ် ဥပမာများ

ကျွန်ုပ်တို့တွင် အောက်ပါ XML ဖိုင်၊ " note.xml " ရှိသည်ဟု ယူဆပါ။

<?xml version="1.0" encoding="UTF-8"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>

ဥပမာ

XML ဖိုင်တွင် ဒြပ်စင်တစ်ခုစီမှ ဒေတာကို ထုတ်ပါ-

<?php
$xml=simplexml_load_file("note.xml");
echo $xml->to . "<br>";
echo $xml->from . "<br>";
echo $xml->heading . "<br>";
echo $xml->body;
?>

ဥပမာ

XML ဖိုင်တွင် ကလေး node တစ်ခုစီအတွက် ဒြပ်စင်အမည်နှင့် ဒေတာကို ထုတ်ပေးသည်-

<?php
$xml=simplexml_load_file("note.xml");
echo $xml->getName() . "<br>";

foreach($xml->children() as $child)
  {
  echo $child->getName() . ": " . $child . "<br>";
  }
?>

❮ PHP SimpleXML အကိုးအကား