PHP get_html_translation_table() º¯Êý
ʵÀý
Êä³ö htmlspecialchars º¯ÊýʹÓõķÒë±í£º
<?php
print_r (get_html_translation_table()); // HTML_SPECIALCHARS is default.
?>
print_r (get_html_translation_table()); // HTML_SPECIALCHARS is default.
?>
ÔËÐÐʵÀý ?
¶¨ÒåºÍÓ÷¨
get_html_translation_table() º¯Êý·µ»Ø htmlentities() ºÍ htmlspecialchars() º¯ÊýʹÓõķÒë±í¡£
Ìáʾ£ºÒ»Ð©×Ö·û¿ÉÒÔ°´ÕÕÈô¸ÉÖÖ·½Ê½½øÐбàÂë¡£get_html_translation_table() º¯Êý·µ»Ø×îÆÕͨµÄ±àÂë¡£
Óï·¨
get_html_translation_table(function,flags,character-set)
²ÎÊý | ÃèÊö |
---|---|
function | ¿ÉÑ¡¡£¹æ¶¨·µ»ØÄĸö·Òë±í¡£ ¿ÉÄܵÄÖµ£º
|
flags | ¿ÉÑ¡¡£¹æ¶¨·Òë±í½«°üº¬ÄÄÖÖÒýºÅÒÔ¼°·Òë±íÓÃÓÚÄÄÖÖÎĵµÀàÐÍ¡£
¿ÉÓõÄÒýºÅÀàÐÍ£º
¹æ¶¨·Òë±íÊÊÓõÄÎĵµÀàÐ͵ĸ½¼Ó flags£º
|
character-set | ¿ÉÑ¡¡£Ò»¸ö¹æ¶¨ÁËҪʹÓõÄ×Ö·û¼¯µÄ×Ö·û´®¡£ ÔÊÐíµÄÖµ£º
×¢ÊÍ£ºÔÚ PHP 5.4 ֮ǰµÄ°æ±¾£¬ÎÞ·¨±»Ê¶±ðµÄ×Ö·û¼¯½«±»ºöÂÔ²¢ÓÉ ISO-8859-1 Ìæ´ú¡£×Ô PHP 5.4 Æð£¬ÎÞ·¨±»Ê¶±ðµÄ×Ö·û¼¯½«±»ºöÂÔ²¢ÓÉ UTF-8 Ìæ´ú¡£ |
¼¼Êõϸ½Ú
·µ»ØÖµ£º | ÒÔÊý×éÐÎʽ·µ»Ø·Òë±í£¬Ôʼ×Ö·û×÷Ϊ¼üÃû£¬ÊµÌå×÷Ϊ¼üÖµ¡£ |
---|---|
PHP °æ±¾£º | 4+ |
¸üÐÂÈÕÖ¾£º | ÔÚ PHP 5 ÖУ¬character-set ²ÎÊýµÄĬÈÏÖµ¸ÄΪ UTF-8¡£ ÔÚ PHP 5.4 ÖУ¬ÐÂÔöÁËÓÃÓڹ涨·Òë±íÊÊÓõÄÎĵµÀàÐ͵ĸ½¼Ó flags£ºENT_HTML401¡¢ENT_HTML5¡¢ENT_XML1 ºÍ ENT_XHTML¡£ ÔÚ PHP 5.3.4 ÖУ¬ÐÂÔöÁË character-set ²ÎÊý¡£ |
¸ü¶àʵÀý
ʵÀý
HTML_SPECIALCHARS µÄ·Òë±í£º
<?php
print_r (get_html_translation_table(HTML_SPECIALCHARS));
?>
print_r (get_html_translation_table(HTML_SPECIALCHARS));
?>
Displaying character and entity name:
Array
(
["] => "
[&] => &
[<] => <
[>] => >
)
(
["] => "
[&] => &
[<] => <
[>] => >
)
ʵÀý 2
HTML_ENTITIES µÄ·Òë±í£º
<?php
print_r (get_html_translation_table(HTML_ENTITIES));
?>
print_r (get_html_translation_table(HTML_ENTITIES));
?>
ÏÔʾ×Ö·û¼°Æä¶ÔÓ¦µÄʵÌåÃû³Æ£º
Array
(
["] => "
[&] => &
[<] => <
[>] => >
[ ] =>
[?] => ¡
[¡é] => ¢
[¡ê] => £
[¡è] => ¤
[£¤] => ¥
[|] => ¦
[¡ì] => §
[¡§] => ¨
[?] => ©
[a] => ª
[?] => «
[?] => ¬
[-] => ­
[?] => ®
[¡¥] => ¯
[¡ã] => °
[¡À] => ±
[2] => ²
[3] => ³
[¡ä] => ´
[¦Ì] => µ
[?] => ¶
[¡¤] => ·
[?] => ¸
[1] => ¹
[o] => º
[?] => »
[?] => ¼
[?] => ½
[?] => ¾
[?] => ¿
[¨¤] => À
[¨¢] => Á
[?] => Â
[?] => Ã
[?] => Ä
[?] => Å
[?] => Æ
[?] => Ç
[¨¨] => È
[¨¦] => É
[¨º] => Ê
[?] => Ë
[¨¬] => Ì
[¨ª] => Í
[?] => Î
[?] => Ï
[D] => Ð
[?] => Ñ
[¨°] => Ò
[¨®] => Ó
[?] => Ô
[?] => Õ
[?] => Ö
[¡Á] => ×
[?] => Ø
[¨´] => Ù
[¨²] => Ú
[?] => Û
[¨¹] => Ü
[Y] => Ý
[T] => Þ
[?] => ß
[¨¤] => à
[¨¢] => á
[a] => â
[?] => ã
[?] => ä
[?] => å
[?] => æ
[?] => ç
[¨¨] => è
[¨¦] => é
[¨º] => ê
[?] => ë
[¨¬] => ì
[¨ª] => í
[?] => î
[?] => ï
[e] => ð
[?] => ñ
[¨°] => ò
[¨®] => ó
[?] => ô
[?] => õ
[?] => ö
[¡Â] => ÷
[?] => ø
[¨´] => ù
[¨²] => ú
[?] => û
[¨¹] => ü
[y] => ý
[t] => þ
[?] => ÿ
[?] => Œ
[?] => œ
[?] => Š
[?] => š
[?] => Ÿ
[?] => ƒ
[?] => ˆ
[?] => ˜
[Α] => Α
[Β] => Β
[Γ] => Γ
[Δ] => Δ
[Ε] => Ε
[Ζ] => Ζ
[Η] => Η
[Θ] => Θ
[Ι] => Ι
[Κ] => Κ
[Λ] => Λ
[Μ] => Μ
[Ν] => Ν
[Ξ] => Ξ
[Ο] => Ο
[Π] => Π
[Ρ] => Ρ
[Σ] => Σ
[Τ] => Τ
[Υ] => Υ
[Φ] => Φ
[Χ] => Χ
[Ψ] => Ψ
[Ω] => Ω
[α] => α
[β] => β
[γ] => γ
[δ] => δ
[ε] => ε
[ζ] => ζ
[η] => η
[θ] => θ
[ι] => ι
[κ] => κ
[λ] => λ
[μ] => μ
[ν] => ν
[ξ] => ξ
[ο] => ο
[π] => π
[ρ] => ρ
[ς] => ς
[σ] => σ
[τ] => τ
[υ] => υ
[φ] => φ
[χ] => χ
[ψ] => ψ
[ω] => ω
[ϑ] => ϑ
[ϒ] => ϒ
[ϖ] => ϖ
[ ] =>  
[ ] =>  
[ ] =>  
[] => ‌
[] => ‍
[] => ‎
[] => ‏
[¨C] => –
[¡ª] => —
['] => ‘
['] => ’
[?] => ‚
["] => “
["] => ”
[?] => „
[?] => †
[?] => ‡
[?] => •
[¡] => …
[¡ë] => ‰
[′] => ′
[″] => ″
[?] => ‹
[?] => ›
[‾] => ‾
[⁄] => ⁄
[€] => €
[ℑ] => ℑ
[℘] => ℘
[ℜ] => ℜ
[?] => ™
[ℵ] => ℵ
[←] => ←
[↑] => ↑
[→] => →
[↓] => ↓
[↔] => ↔
[↵] => ↵
[⇐] => ⇐
[⇑] => ⇑
[⇒] => ⇒
[⇓] => ⇓
[⇔] => ⇔
[∀] => ∀
[∂] => ∂
[∃] => ∃
[∅] => ∅
[∇] => ∇
[∈] => ∈
[∉] => ∉
[∋] => ∋
[∏] => ∏
[∑] => ∑
[−] => −
[∗] => ∗
[√] => √
[∝] => ∝
[∞] => ∞
[∠] => ∠
[∧] => ∧
[∨] => ∨
[∩] => ∩
[∪] => ∪
[∫] => ∫
[∴] => ∴
[∼] => ∼
[≅] => ≅
[≈] => ≈
[≠] => ≠
[≡] => ≡
[≤] => ≤
[≥] => ≥
[⊂] => ⊂
[⊃] => ⊃
[⊄] => ⊄
[⊆] => ⊆
[⊇] => ⊇
[⊕] => ⊕
[⊗] => ⊗
[⊥] => ⊥
[⋅] => ⋅
[⌈] => ⌈
[⌉] => ⌉
[⌊] => ⌊
[⌋] => ⌋
[〈] => ⟨
[〉] => ⟩
[◊] => ◊
[♠] => ♠
[♣] => ♣
[♥] => ♥
[♦] => ♦
)
(
["] => "
[&] => &
[<] => <
[>] => >
[ ] =>
[?] => ¡
[¡é] => ¢
[¡ê] => £
[¡è] => ¤
[£¤] => ¥
[|] => ¦
[¡ì] => §
[¡§] => ¨
[?] => ©
[a] => ª
[?] => «
[?] => ¬
[-] => ­
[?] => ®
[¡¥] => ¯
[¡ã] => °
[¡À] => ±
[2] => ²
[3] => ³
[¡ä] => ´
[¦Ì] => µ
[?] => ¶
[¡¤] => ·
[?] => ¸
[1] => ¹
[o] => º
[?] => »
[?] => ¼
[?] => ½
[?] => ¾
[?] => ¿
[¨¤] => À
[¨¢] => Á
[?] => Â
[?] => Ã
[?] => Ä
[?] => Å
[?] => Æ
[?] => Ç
[¨¨] => È
[¨¦] => É
[¨º] => Ê
[?] => Ë
[¨¬] => Ì
[¨ª] => Í
[?] => Î
[?] => Ï
[D] => Ð
[?] => Ñ
[¨°] => Ò
[¨®] => Ó
[?] => Ô
[?] => Õ
[?] => Ö
[¡Á] => ×
[?] => Ø
[¨´] => Ù
[¨²] => Ú
[?] => Û
[¨¹] => Ü
[Y] => Ý
[T] => Þ
[?] => ß
[¨¤] => à
[¨¢] => á
[a] => â
[?] => ã
[?] => ä
[?] => å
[?] => æ
[?] => ç
[¨¨] => è
[¨¦] => é
[¨º] => ê
[?] => ë
[¨¬] => ì
[¨ª] => í
[?] => î
[?] => ï
[e] => ð
[?] => ñ
[¨°] => ò
[¨®] => ó
[?] => ô
[?] => õ
[?] => ö
[¡Â] => ÷
[?] => ø
[¨´] => ù
[¨²] => ú
[?] => û
[¨¹] => ü
[y] => ý
[t] => þ
[?] => ÿ
[?] => Œ
[?] => œ
[?] => Š
[?] => š
[?] => Ÿ
[?] => ƒ
[?] => ˆ
[?] => ˜
[Α] => Α
[Β] => Β
[Γ] => Γ
[Δ] => Δ
[Ε] => Ε
[Ζ] => Ζ
[Η] => Η
[Θ] => Θ
[Ι] => Ι
[Κ] => Κ
[Λ] => Λ
[Μ] => Μ
[Ν] => Ν
[Ξ] => Ξ
[Ο] => Ο
[Π] => Π
[Ρ] => Ρ
[Σ] => Σ
[Τ] => Τ
[Υ] => Υ
[Φ] => Φ
[Χ] => Χ
[Ψ] => Ψ
[Ω] => Ω
[α] => α
[β] => β
[γ] => γ
[δ] => δ
[ε] => ε
[ζ] => ζ
[η] => η
[θ] => θ
[ι] => ι
[κ] => κ
[λ] => λ
[μ] => μ
[ν] => ν
[ξ] => ξ
[ο] => ο
[π] => π
[ρ] => ρ
[ς] => ς
[σ] => σ
[τ] => τ
[υ] => υ
[φ] => φ
[χ] => χ
[ψ] => ψ
[ω] => ω
[ϑ] => ϑ
[ϒ] => ϒ
[ϖ] => ϖ
[ ] =>  
[ ] =>  
[ ] =>  
[] => ‌
[] => ‍
[] => ‎
[] => ‏
[¨C] => –
[¡ª] => —
['] => ‘
['] => ’
[?] => ‚
["] => “
["] => ”
[?] => „
[?] => †
[?] => ‡
[?] => •
[¡] => …
[¡ë] => ‰
[′] => ′
[″] => ″
[?] => ‹
[?] => ›
[‾] => ‾
[⁄] => ⁄
[€] => €
[ℑ] => ℑ
[℘] => ℘
[ℜ] => ℜ
[?] => ™
[ℵ] => ℵ
[←] => ←
[↑] => ↑
[→] => →
[↓] => ↓
[↔] => ↔
[↵] => ↵
[⇐] => ⇐
[⇑] => ⇑
[⇒] => ⇒
[⇓] => ⇓
[⇔] => ⇔
[∀] => ∀
[∂] => ∂
[∃] => ∃
[∅] => ∅
[∇] => ∇
[∈] => ∈
[∉] => ∉
[∋] => ∋
[∏] => ∏
[∑] => ∑
[−] => −
[∗] => ∗
[√] => √
[∝] => ∝
[∞] => ∞
[∠] => ∠
[∧] => ∧
[∨] => ∨
[∩] => ∩
[∪] => ∪
[∫] => ∫
[∴] => ∴
[∼] => ∼
[≅] => ≅
[≈] => ≈
[≠] => ≠
[≡] => ≡
[≤] => ≤
[≥] => ≥
[⊂] => ⊂
[⊃] => ⊃
[⊄] => ⊄
[⊆] => ⊆
[⊇] => ⊇
[⊕] => ⊕
[⊗] => ⊗
[⊥] => ⊥
[⋅] => ⋅
[⌈] => ⌈
[⌉] => ⌉
[⌊] => ⌊
[⌋] => ⌋
[〈] => ⟨
[〉] => ⟩
[◊] => ◊
[♠] => ♠
[♣] => ♣
[♥] => ♥
[♦] => ♦
)
PHP String ²Î¿¼ÊÖ²á