လက်ရှိတည်နေရာ: ပင်မစာမျက်နှာ> ဖန်ရှင်အမျိုးအစားများ> html_entity_decode

html_entity_decode

HTML အဖွဲ့အစည်းများအားသက်ဆိုင်ရာဇာတ်ကောင်များသို့ပြောင်းပါ
အမည်:html_entity_decode
အမျိုးအစား:ကြိုး
programming language:php
တစ်ကြောင်းဖြင့်အကျဉ်းချုပ်:HTML အဖွဲ့အစည်းများအားဇာတ်ကောင်များသို့ပြောင်းပါ။

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

html_entity_decode() function ကို HTML entities များကိုစာလုံးအဖြစ်ပြောင်းလဲပေးသည်။

html_entity_decode() function () function () function သည် htmlentities() function ကို၏ပြောင်းပြန်လုပ်ဆောင်ချက်ဖြစ်သည်။

နမူနာ

ဥပမာ 1

HTML အဖွဲ့အစည်းများအားဇာတ်ကောင်များသို့ပြောင်းပါ။

 <? PHP
$ str = "<? w3s? h3 °°။ §" " ;
ပဲ့တင်သံ html_entity_decode ( $ str ) ;
>

အထက်ပါကုဒ်၏ HTML output သည်အောက်ပါအတိုင်းဖြစ်သည် (အရင်းအမြစ်ကုဒ်ကိုကြည့်ပါ):

 <! DOCTYPE HTML >
<html>​
<body>​
<? W3s ? H ??? ? >
</ body >
</ html >

အထက်ပါကုဒ်၏ browser output ကို:

 <? W3s ? H ??? ? >

ဥပမာ 2

HTML အဖွဲ့အစည်းများအားဇာတ်ကောင်များသို့ပြောင်းပါ။

 <? PHP
$ str = "Bill & Amp; & # 039; Steve & # 039; ;
ပဲ့တင်သံ html_entity_decode ( $ str , ent_compat ) ; // သာနှစ်ဆကိုးကားပြောင်းလဲ
ပဲ့တင်သံ "<br> <br>" ;
ပဲ့တင်သံ html_entity_decode ( $ str , ent_quotes ) ; // နှစ်ဆနှင့်တစ်ခုတည်းကိုးကားပြောင်းလဲ
ပဲ့တင်သံ "<br> <br>" ;
ပဲ့တင်သံ html_entity_decode ( $ str , ent_noquotes ) ; // အဘယ်သူမျှမကိုးကားအမှတ်အသားများပြောင်းလဲနေကြသည်
>

အထက်ပါကုဒ်၏ HTML output ကို (source code ကိုကြည့်ပါ):

 < ! DOCTYPE HTML >
<html>​
<body>​
Bill & & # 039; Steve & # 039; <br>
Bill & ' Steve ' <br>
Bill & & 'Steve'
< / body >
< / html >

အထက်ပါကုဒ်၏ browser output ကို:

 Bill & 'Steve'
Bill & 'Steve'
Bill & 'Steve'

ဥပမာ 3

HTML အဖွဲ့အစည်းများအားအနောက်ဥရောပဇာတ်ကောင်အစုံများကို အသုံးပြု. ဇာတ်ကောင်များသို့ဇာတ်ကောင်များသို့ပြောင်းပါ။

 <? PHP
$ str = "ငါ့နာမကဘာလဲ? စိတ်ကောင်းခြင်းငါနော်ဝေပေါ့" ;
ပဲ့တင်သံ html_entity_decode ( $ str , ent_quotes "iso - 8859-1 ) ,
>

အထက်ပါကုဒ်၏ HTML output ကို (source code ကိုကြည့်ပါ):

 < ! DOCTYPE HTML >
<html>​
<body>​
ကျွန်တော့်အမည်မှာ ? yvind ? စိတ်ကောင်းသော ။ ငါ နော်ဝေ မဟုတ်ဘူး
< / body >
< / html >

အထက်ပါကုဒ်၏ browser output ကို:

 ငါ့နာမည်လား? Sane ။ ငါနော်ဝေပေါ့

သဒ္ဒါ

 HTML_entity_Decode ( string , flags , character - set )
တေးရေး ဖေါ်ပြ
ကြိုး လိုအပ်ပါတယ် decoded ခံရဖို့ string ကိုဖေါ်ပြသည်။
အလံများ

optional ကို။ ကိုးကားချက်များနှင့်မည်သို့ကိုင်တွယ်ရမည်ကိုအသေးစိတ်ဖော်ပြထားသည်။

ရရှိနိုင် Quote အမျိုးအစားများ:

  • ent_compat - ပုံမှန်။ နှစ်ဆကိုးကားသာ decode ။
  • ent_quotes - နှစ်ဆနှင့်တစ်ခုတည်းကိုးကားချက်များကို decode ။
  • Ent_Noquotes - အဘယ်သူမျှမကိုးကားအမှတ်အသားများကုဒ်များနေကြသည်။

အသုံးပြုသောစာရွက်စာတမ်းအမျိုးအစားကိုသတ်မှတ်သည့်အလံများ -

  • ent_html401 - ပုံမှန်။ Process Code ကို HTML 4.01 အဖြစ်။
  • ent_html5 - HTML 5 အဖြစ် Process code ကို။
  • Ent_XML1 - XML ​​1 အဖြစ်လုပ်ငန်းစဉ်ကုဒ်။
  • ent_xhtml - XHTML အဖြစ် process code ။
ဇာတ်ကောင် - အစုံ

optional ကို။ string တန်ဖိုးကိုအသုံးပြုမည့်စာလုံးအစုကိုသတ်မှတ်ခြင်း။

ခွင့်ပြုထားသောတန်ဖိုးများ

  • UTF-8 - ပုံမှန်။ Ascii သည် Multi-byte 8-bit unicode နှင့်လိုက်ဖက်သည်
  • ISO-8859-1 - အနောက်ဥရောပ
  • ISO-8859-15 - အနောက်ဥရောပ (Euro Separt) ကို ISO-8859-1 တွင်ပြင်သစ်နှင့်ဖင်လန်အက္ခရာများမှထည့်သွင်းခဲ့သည်။
  • CP866 - DOS-PLESSIC CYRISIC ဇာတ်ကောင်အစုံ
  • CP1251 - Windows-Different Cyrillic ဇာတ်ကောင်အစုံ
  • CP1252 - Windows-Director Western Upport ဇာတ်ကောင်အစုံ
  • koi8-r - ရုရှား
  • Big5 - ရိုးရာတရုတ်လူမျိုးများသည်အဓိကအားဖြင့်ထိုင်ဝမ်တွင်အသုံးပြုသည်
  • GB2312 - ရိုးရှင်းသောတရုတ်,
  • Big5-Hskscs - ဟောင်ကောင်ချဲ့ထွင်မှုနှင့်အတူ Big5
  • shift_jis - ဂျပန်
  • EUC-JP - ဂျပန်
  • MacRomen - MAC operating system မှအသုံးပြုသောဇာတ်ကောင်အစုံ

မှတ်ချက်။ ။ PHP 5.4 မတိုင်မီကမူဗားရှင်းများတွင်အသိအမှတ်မပြုသောဇာတ်ကောင်အစုံများကိုလျစ်လျူရှုပြီး ISO-8859-1 ဖြင့်အစားထိုးလိမ့်မည်။ PHP 5.4 ကိုကတည်းကအသိအမှတ်မပြုသောဇာတ်ကောင်အစုံများကိုလျစ်လျူရှုပြီး UTF-8 ဖြင့်အစားထိုးလိမ့်မည်။

သက်ဆိုင်သောဖင်ခှ်ရှင်းများ
  • တစ်ခုထွက်ပြေးလွတ်မြောက် string ကိုထုတ်ဖော်ပြသခဲ့သည် stripslashes

    stripslashes

    တစ်ခုထွက်ပြေးလွတ်မြေ
  • string တစ်ခု၏လိုင်းအသစ်များမတိုင်မီ HTML newline tag ကိုထည့်ပါ nl2br

    nl2br

    stringတစ်ခု၏လိုင်းအသ
  • string ကို encode လုပ်ဖို့ uuencode ကိုသုံးပါ convert_uuencode

    convert_uuencode

    stringကိုencodeလုပ်ဖ
  • string တစ်ခုအစတွင်ဇာတ်ကောင်အများအပြား၏ binary ဘေးကင်းလုံခြုံနှိုင်းယှဉ် strncmp

    strncmp

    stringတစ်ခုအစတွင်ဇာတ
  • htmlspecialchars () နှင့် htmlenties () ကိုအသုံးပြုပြီးနောက်ပြောင်းလဲခြင်းစားပွဲကိုပြန်ပို့သည် () get_html_translation_table

    get_html_translation_table

    htmlspecialchars()နှ
  • ယုတ္တိဖြစ်သောဟေဗြဲဘာသာကို Visual-Hebrew သို့ပြောင်းရန်နှင့်အသစ်များပြောင်းလဲပါ hebrevc

    hebrevc

    ယုတ္တိဖြစ်သောဟေဗြဲဘာ
  • string ကိုပြောင်းပြန် strrev

    strrev

    stringကိုပြောင်းပြန်
  • string ၏အစနှင့်အဆုံးမှနေရာများ (သို့မဟုတ်အခြားအက္ခရာများ) ကိုဖယ်ရှားပါ trim

    trim

    string၏အစနှင့်အဆုံးမ
လူကြိုက်များသော ဆောင်းပါးများ