PHP html_entity_decode() ပုံစံ
အကြောင်းကြောင်း
HTML အကျဉ်း ကို စာပုံ သို့ ပြောင်းလဲခြင်း
<?php $str = "<© W3Sçh°°¦§>"; echo html_entity_decode($str); ?>
အထဲတွင် ရှိသော လုပ်စာကြော်ငြာ ကို ကြည့်မည် (အရင်းမြစ် ကို ကြည့်ပါ) :
<!DOCTYPE html> <html> <body> <? W3S?h????> </body> </html>
အခြေခံ စကားလုံး နှင့် ဘာသာပြန် အားဖြင့် ထုတ်လုပ်ထားသော အခြေခံ စကားလုံး
<? W3S?h????>
အသုံးပြုခြင်း နှင့် လိုက်နာခြင်း
html_entity_decode() ပုံစံ က HTML အချက်အလက် ကို စာကို ပြောင်းလဲသည်。
html_entity_decode() ပုံစံ ကို htmlentities() Inverse function of the function.
Syntax
html_entity_decode(string,flags,character-set)
Parameter | Description |
---|---|
string | Required. Specify the string to be decoded. |
flags |
Optional. Specify how quotes are processed and which document type is used. Available quote types:
အသုံးပြုသော သုတေသနအမျိုးအစား အသုံးပြုသော additional flags ဖော်ထုတ်ထားသည်:
|
character-set |
ဆိုင်းငံ့။ ကြောက်ချက် string အား အသုံးပြုရန် ဖော်ထုတ်ထားသည် ခွင့်ပြုထားသော အချက်
မှတ်ချက်:PHP 5.4 အပြင်သာ အသိအမှတ်ပြုခြင်းမရှိသေးသော character set အား လျှောက်သည့် ISO-8859-1 ဖြင့် ပြောင်းလဲထားသည်။ PHP 5.4 မှ စတင်၍ အသိအမှတ်ပြုခြင်းမရှိသေးသော character set အား လျှောက်သည့် UTF-8 ဖြင့် ပြောင်းလဲထားသည်。 |
နည်းပါးစွာ
ပြန်လည်ပေးသော အချက် | ပြောင်းလဲထားသော ကိုယ်စားပုံ ပြန်လည်ပေးသည် |
PHP ပုံစံ: | 4.3.0+ |
အစီရင်ခံစာ:
ပုံစံ | အကျိုးသုံးသည် |
---|---|
PHP 5 | character-set ပြင်ဆင်ထားသော ပုံစံအချက် အား UTF-8 ဖြင့် ပြောင်းလဲခဲ့သည်。 |
PHP 5.4 |
ဖြစ်ပေါ်စေတတ်သည် သုတေသနများအတွက် အသုံးပြုရန် ဖော်ထုတ်ထားသော flags ပြင်ဆင်ခဲ့သည်:
|
PHP 5.3.4 | အသုံးပြုခြင်း အတွက် အသုံးပြုထားသော အခြေခံ အကျဉ်း ကို အသုံးပြုခြင်း ဖြင့် အသုံးပြုထားပါ။ |
ပိုမိုသော အမှတ်အသား
အမှတ် 1
HTML အကျဉ်း ကို စာပုံ သို့ ပြောင်းလဲခြင်း
<?php $str = "Bill & 'Steve'"; echo html_entity_decode($str, ENT_COMPAT); // Only double quotes conversion echo "<br>"; echo html_entity_decode($str, ENT_QUOTES); // Double and single quotes conversion echo "<br>"; echo html_entity_decode($str, ENT_NOQUOTES); // အကျဉ်း မပြောင်းလဲ ?>
အခြေခံ စကားလုံး နှင့် ဘာသာပြန် အားဖြင့် ထုတ်လုပ်ထားသော အခြေခံ စကားလုံး
<!DOCTYPE html> <html> <body> Bill & 'Steve'<br> Bill & 'Steve'<br> Bill & 'Steve' </body> </html>
အခြေခံ စကားလုံး နှင့် ဘာသာပြန် အားဖြင့် ထုတ်လုပ်ထားသော အခြေခံ စကားလုံး
Bill & 'Steve' Bill & 'Steve' Bill & 'Steve'
အမှတ် 2
Western European character set ကို အသုံးပြု၍ HTML အကျဉ်း ကို စာပုံ သို့ ပြောင်းလဲခြင်း
<?php $str = "My name is Øyvind Åsane. I'm Norwegian."; echo html_entity_decode($str, ENT_QUOTES, "ISO-8859-1"); ?>
အခြေခံ စကားလုံး နှင့် ဘာသာပြန် အားဖြင့် ထုတ်လုပ်ထားသော အခြေခံ စကားလုံး
<!DOCTYPE html> <html> <body> My name is ?yvind ?sane. I'm Norwegian. </body> </html>
အခြေခံ စကားလုံး နှင့် ဘာသာပြန် အားဖြင့် ထုတ်လုပ်ထားသော အခြေခံ စကားလုံး
My name is ?yvind ?sane. I'm Norwegian.