PHP get_html_translation_table() 函数
实例
输出 htmlspecialchars 函数使用的翻译表:
- <?php
- print_r (get_html_translation_table()); // HTML_SPECIALCHARS 为默认
- ?>
定义和用法
get_html_translation_table() 函数返回 htmlentities() 和 htmlspecialchars() 函数使用的翻译表。
提示:某些字符可以按照多种方式进行编码。get_html_translation_table() 函数返回最普通的编码。
语法
- get_html_translation_table(function,flags,character-set)
参数 | 描述 |
---|---|
function |
可选。规定返回哪个翻译表。
可能的值:
|
flags |
可选。规定翻译表将包含哪种引号以及翻译表用于哪种文档类型。
可用的引号类型:
|
character-set |
可选。字符串值,规定要使用的字符集。
允许的值:
|
技术细节
返回值: | 以数组形式返回翻译表,原始字符作为键名,实体作为键值。 |
PHP 版本: | 4+ |
更新日志:
版本 | 说明 |
---|---|
PHP 5 | character-set 参数的默认值改为 UTF-8。 |
PHP 5.4 |
新增了用于规定翻译表适用的文档类型的附加 flags:
|
PHP 5.3.4 | 新增了 character-set 参数。 |
更多实例
实例
HTML_SPECIALCHARS 的翻译表:
- <?php
- print_r (get_html_translation_table(HTML_SPECIALCHARS));
- ?>
显示字符和实体名:
- Array
- (
- ["] => "
- [&] => &
- [<] => <
- [>] => >
- )
例子 2
HTML_ENTITIES 的翻译表:
- <?php
- print_r (get_html_translation_table(HTML_ENTITIES));
- ?>
显示字符和实体名:
- Array
- (
- ["] => "
- [&] => &
- [<] => <
- [>] => >
- [ ] => 聽
- [?] => 隆
- [?] => 垄
- [?] => 拢
- [?] => 陇
- [?] => 楼
- [?] => 娄
- [?] => 搂
- [?] => 篓
- [?] => 漏
- [?] => 陋
- [?] => 芦
- [?] => 卢
- [?] => 颅
- [?] => 庐
- [?] => 炉
- [?] => 掳
- [?] => 卤
- [?] => 虏
- [?] => 鲁
- [?] => 麓
- [?] => 碌
- [?] => 露
- [?] => 路
- [?] => 赂
- [?] => 鹿
- [?] => 潞
- [?] => 禄
- [?] => 录
- [?] => 陆
- [?] => 戮
- [?] => 驴
- [?] => 脌
- [?] => 脕
- [?] => 脗
- [?] => 脙
- [?] => 脛
- [?] => 脜
- [?] => 脝
- [?] => 脟
- [?] => 脠
- [?] => 脡
- [?] => 脢
- [?] => 脣
- [?] => 脤
- [?] => 脥
- [?] => 脦
- [?] => 脧
- [?] => 脨
- [?] => 脩
- [?] => 脪
- [?] => 脫
- [?] => 脭
- [?] => 脮
- [?] => 脰
- [?] => 脳
- [?] => 脴
- [?] => 脵
- [?] => 脷
- [?] => 脹
- [?] => 脺
- [?] => 脻
- [?] => 脼
- [?] => 脽
- [?] => 脿
- [?] => 谩
- [?] => 芒
- [?] => 茫
- [?] => 盲
- [?] => 氓
- [?] => 忙
- [?] => 莽
- [?] => 猫
- [?] => 茅
- [?] => 锚
- [?] => 毛
- [?] => 矛
- [?] => 铆
- [?] => 卯
- [?] => 茂
- [?] => 冒
- [?] => 帽
- [?] => 貌
- [?] => 贸
- [?] => 么
- [?] => 玫
- [?] => 枚
- [?] => 梅
- [?] => 酶
- [?] => 霉
- [?] => 煤
- [?] => 没
- [?] => 眉
- [?] => 媒
- [?] => 镁
- [?] => 每
- [?] => 艗
- [?] => 艙
- [?] => 艩
- [?] => 拧
- [?] => 鸥
- [?] => 茠
- [?] => 藛
- [?] => 藴
- [Α] => 螒
- [Β] => 螔
- [Γ] => 螕
- [Δ] => 螖
- [Ε] => 螘
- [Ζ] => 螙
- [Η] => 螚
- [Θ] => 螛
- [Ι] => 螜
- [Κ] => 螝
- [Λ] => 螞
- [Μ] => 螠
- [Ν] => 螡
- [Ξ] => 螢
- [Ο] => 螣
- [Π] => 螤
- [Ρ] => 巍
- [Σ] => 危
- [Τ] => 韦
- [Υ] => 违
- [Φ] => 桅
- [Χ] => 围
- [Ψ] => 唯
- [Ω] => 惟
- [α] => 伪
- [β] => 尾
- [γ] => 纬
- [δ] => 未
- [ε] => 蔚
- [ζ] => 味
- [η] => 畏
- [θ] => 胃
- [ι] => 喂
- [κ] => 魏
- [λ] => 位
- [μ] => 渭
- [ν] => 谓
- [ξ] => 尉
- [ο] => 慰
- [π] => 蟺
- [ρ] => 蟻
- [?] => 蟼
- [σ] => 蟽
- [τ] => 蟿
- [υ] => 蠀
- [φ] => 蠁
- [χ] => 蠂
- [ψ] => 蠄
- [ω] => 蠅
- [?] => 蠎
- [?] => 蠏
- [?] => 蠔
- [?] => 鈥�
- [?] => 鈥�
- [?] => 鈥�
- [?] => 鈥�
- [?] => 鈥�
- [?] => 鈥�
- [?] => 鈥�
- [?] => 鈥�
- [?] => 鈥�
- [?] => 鈥�
- [?] => 鈥�
- [?] => 鈥�
- [?] => 鈥�
- [?] => 鈥�
- [?] => 鈥�
- [?] => 鈥�
- [?] => 鈥�
- [?] => 鈥�
- [?] => 鈥�
- [?] => 鈥�
- [′] => 鈥�
- [″] => 鈥�
- [?] => 鈥�
- [?] => 鈥�
- [ ̄] => 鈥�
- [?] => 鈦�
- [?] => 鈧�
- [?] => 鈩�
- [?] => 鈩�
- [?] => 鈩�
- [?] => 鈩�
- [?] => 鈩�
- [←] => 鈫�
- [↑] => 鈫�
- [→] => 鈫�
- [↓] => 鈫�
- [?] => 鈫�
- [?] => 鈫�
- [?] => 鈬�
- [?] => 鈬�
- [?] => 鈬�
- [?] => 鈬�
- [?] => 鈬�
- [?] => 鈭�
- [?] => 鈭�
- [?] => 鈭�
- [?] => 鈭�
- [?] => 鈭�
- [∈] => 鈭�
- [?] => 鈭�
- [?] => 鈭�
- [∏] => 鈭�
- [∑] => 鈭�
- [?] => 鈭�
- [?] => 鈭�
- [√] => 鈭�
- [∝] => 鈭�
- [∞] => 鈭�
- [∠] => 鈭�
- [∧] => 鈭�
- [∨] => 鈭�
- [∩] => 鈭�
- [∪] => 鈭�
- [∫] => 鈭�
- [∴] => 鈭�
- [~] => 鈭�
- [?] => 鈮�
- [≈] => 鈮�
- [≠] => 鈮�
- [≡] => 鈮�
- [≤] => 鈮�
- [≥] => 鈮�
- [?] => 鈯�
- [?] => 鈯�
- [?] => 鈯�
- [?] => 鈯�
- [?] => 鈯�
- [⊕] => 鈯�
- [?] => 鈯�
- [⊥] => 鈯�
- [?] => 鈰�
- [?] => 鈱�
- [?] => 鈱�
- [?] => 鈱�
- [?] => 鈱�
- [?] => 鉄�
- [?] => 鉄�
- [?] => 鈼�
- [?] => 鈾�
- [?] => 鈾�
- [?] => 鈾�
- [?] => 鈾�
- )