PHP xml_parse_into_struct() လုပ်ဆောင်ချက်
ဥပမာ
XML ဒေတာကို အခင်းအကျင်းတစ်ခုအဖြစ် ခွဲခြမ်းစိတ်ဖြာပါ ( note.xml မှ ):
<?php
$xmlparser = xml_parser_create();
$fp = fopen("note.xml",
"r");
$xmldata = fread($fp, 4096);
// Parse XML data into an array
xml_parse_into_struct($xmlparser,$xmldata,$values);
xml_parser_free($xmlparser);
print_r($values);
fclose($fp);
?>
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
xml_parse_into_struct() လုပ်ဆောင်ချက်သည် XML အချက်အလက်များကို array တစ်ခုအဖြစ် ခွဲခြမ်းစိပ်ဖြာသည်။
ဤလုပ်ဆောင်ချက်သည် XML ဒေတာအား အခင်းအကျင်း 2 ခုအဖြစ် ပိုင်းခြားပေးသည်-
- တန်ဖိုးအခင်းအကျင်း - ခွဲခြမ်းစိတ်ဖြာထားသော XML မှ ဒေတာများပါရှိသည်။
- Index array - Value array ရှိ တန်ဖိုးများ၏ တည်နေရာအတွက် pointers များ ပါရှိသည်။
အထားအသို
xml_parse_into_struct(parser, data, values, index)
ကန့်သတ်တန်ဖိုးများ
Parameter | Description |
---|---|
parser | Required. Specifies the XML parser to use |
data | Required. Specifies the XML data to parse |
values | Required. Specifies an array with the values of the XML data |
index | Optional. Specifies an array with pointers to the location of the values in values |
နည်းပညာဆိုင်ရာအသေးစိတ်
ပြန်ပို့တန်ဖိုး- | အောင်မြင်မှု ၁။ ဘ၀တွင် ရှုံးနိမ့်ခဲ့သည်။ |
---|---|
PHP ဗားရှင်း- | 4.0+ |
❮ PHP XML Parser အကိုးအကား