Php/func string get html translation table
来自菜鸟教程
PHP get_html_translation_table()函数
例
打印htmlspecialchars函数使用的翻译表:
<?php print_r (get_html_translation_table()); // HTML_SPECIALCHARS is default. ?>
定义和用法
get_html_translation_table()函数返回翻译表使用的翻译表。 htmlentities()
功能。
Tip: 某些字符可以几种方式编码。get_html_translation_table()函数返回最常用的编码。
句法
get_html_translation_table(function,flags,character-set)
参数值
参数 | 描述 |
---|---|
function |
可选的。指定要返回的转换表。 可能的值:
|
flags |
可选的。指定表将包含哪些引号以及该表适用于哪种文档类型。 可用的引用样式为:
用于指定表用于哪种文档类型的其他标志:
|
character-set |
可选的。一个字符串,指定要使用的字符集。 允许的值为:
注意: 在PHP 5.4之前的版本中,无法识别的字符集将被忽略并由ISO-8859-1代替。从PHP 5.4开始,它将被UTF-8取代。 |
技术细节
返回值: | 以数组的形式返回转换表,原始字符为键,实体为值 |
PHP版本: | 4+ |
更新日志: | 的默认值
character-set
参数已在PHP 5中更改为UTF-8 |
更多例子
例
HTML_SPECIALCHARS的表:
<?php print_r (get_html_translation_table(HTML_SPECIALCHARS)); ?>
显示字符和实体名称:
Array ( ["] => " [&] => & [<] => < [>] => > )
例
HTML_ENTITIES表:
<?php print_r (get_html_translation_table(HTML_ENTITIES)); ?>
显示字符和实体名称:
Array ( ["] => " [&] => & [<] => < [>] => > [ ] => [¡] => ¡ [¢] => ¢ [£] => £ [¤] => ¤ [¥] => ¥ [¦] => ¦ [§] => § [¨] => ¨ [©] => © [ª] => ª [«] => « [¬] => ¬ [] => ­ [®] => ® [¯] => ¯ [°] => ° [±] => ± [²] => ² [³] => ³ [´] => ´ [µ] => µ [¶] => ¶ [·] => · [¸] => ¸ [¹] => ¹ [º] => º [»] => » [¼] => ¼ [½] => ½ [¾] => ¾ [¿] => ¿ [À] => À [Á] => Á [Â] =>  [Ã] => à [Ä] => Ä [Å] => Å [Æ] => Æ [Ç] => Ç [È] => È [É] => É [Ê] => Ê [Ë] => Ë [Ì] => Ì [Í] => Í [Î] => Î [Ï] => Ï [Ð] => Ð [Ñ] => Ñ [Ò] => Ò [Ó] => Ó [Ô] => Ô [Õ] => Õ [Ö] => Ö [×] => × [Ø] => Ø [Ù] => Ù [Ú] => Ú [Û] => Û [Ü] => Ü [Ý] => Ý [Þ] => Þ [ß] => ß [à] => à [á] => á [â] => â [ã] => ã [ä] => ä [å] => å [æ] => æ [ç] => ç [è] => è [é] => é [ê] => ê [ë] => ë [ì] => ì [í] => í [î] => î [ï] => ï [ð] => ð [ñ] => ñ [ò] => ò [ó] => ó [ô] => ô [õ] => õ [ö] => ö [÷] => ÷ [ø] => ø [ù] => ù [ú] => ú [û] => û [ü] => ü [ý] => ý [þ] => þ [ÿ] => ÿ [Œ] => Œ [œ] => œ [Š] => Š [š] => š [Ÿ] => Ÿ [ƒ] => ƒ [ˆ] => ˆ [˜] => ˜ [Α] => Α [Β] => Β [Γ] => Γ [Δ] => Δ [Ε] => Ε [Ζ] => Ζ [Η] => Η [Θ] => Θ [Ι] => Ι [Κ] => Κ [Λ] => Λ [Μ] => Μ [Ν] => Ν [Ξ] => Ξ [Ο] => Ο [Π] => Π [Ρ] => Ρ [Σ] => Σ [Τ] => Τ [Υ] => Υ [Φ] => Φ [Χ] => Χ [Ψ] => Ψ [Ω] => Ω [α] => α [β] => β [γ] => γ [δ] => δ [ε] => ε [ζ] => ζ [η] => η [θ] => θ [ι] => ι [κ] => κ [λ] => λ [μ] => μ [ν] => ν [ξ] => ξ [ο] => ο [π] => π [ρ] => ρ [ς] => ς [σ] => σ [τ] => τ [υ] => υ [φ] => φ [χ] => χ [ψ] => ψ [ω] => ω [ϑ] => ϑ [ϒ] => ϒ [ϖ] => ϖ [ ] =>   [ ] =>   [ ] =>   [] => ‌ [] => ‍ [] => ‎ [] => ‏ [–] => – [—] => — [‘] => ‘ [’] => ’ [‚] => ‚ [“] => “ [”] => ” [„] => „ [†] => † [‡] => ‡ [•] => • […] => … [‰] => ‰ [′] => ′ [″] => ″ [‹] => ‹ [›] => › [‾] => ‾ [⁄] => ⁄ [€] => € [ℑ] => ℑ [℘] => ℘ [ℜ] => ℜ [™] => ™ [ℵ] => ℵ [←] => ← [↑] => ↑ [→] => → [↓] => ↓ [↔] => ↔ [↵] => ↵ [⇐] => ⇐ [⇑] => ⇑ [⇒] => ⇒ [⇓] => ⇓ [⇔] => ⇔ [∀] => ∀ [∂] => ∂ [∃] => ∃ [∅] => ∅ [∇] => ∇ [∈] => ∈ [∉] => ∉ [∋] => ∋ [∏] => ∏ [∑] => ∑ [−] => − [∗] => ∗ [√] => √ [∝] => ∝ [∞] => ∞ [∠] => ∠ [∧] => ∧ [∨] => ∨ [∩] => ∩ [∪] => ∪ [∫] => ∫ [∴] => ∴ [∼] => ∼ [≅] => ≅ [≈] => ≈ [≠] => ≠ [≡] => ≡ [≤] => ≤ [≥] => ≥ [⊂] => ⊂ [⊃] => ⊃ [⊄] => ⊄ [⊆] => ⊆ [⊇] => ⊇ [⊕] => ⊕ [⊗] => ⊗ [⊥] => ⊥ [⋅] => ⋅ [⌈] => ⌈ [⌉] => ⌉ [⌊] => ⌊ [⌋] => ⌋ [〈] => ⟨ [〉] => ⟩ [◊] => ◊ [♠] => ♠ [♣] => ♣ [♥] => ♥ [♦] => ♦ )