English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
A função get_html_translation_table() é usada para retornar a tabela de conversão após o uso de htmlspecialchars() e htmlentities().
array get_html_translation_table ([ int $table = HTML_SPECIALCHARS [, int $flags = ENT_COMPAT | ENT_HTML401 [, string $encoding = "UTF-8" ]]] )
Ele retorna a tabela de conversão usada pelas funções htmlentities() e htmlspecialchars().
Ele retorna a tabela de conversão como um array, os caracteres originais como chave e as entidades como valor.
Atenção: os caracteres especiais podem ser convertidos de várias maneiras. Por exemplo: " pode ser convertido para ", " ou ". get_html_translation_table() retorna a mais comum delas.
Número ordinal | Parâmetros e descrição |
---|---|
1 | table(obrigatório) Esta função contém informações sobre qual tabela retornar HTML_ENTITIES ou HTML_SPECIALCHARS Possíveis valores:
|
2 | flags 可选。指定转换表将包含哪种引号以及转换表用于哪种文档类型。可用的引号类型:
指定转换表适用的文档类型的附加 flags:
|
3 | encoding 可选。一个指定了要使用的字符集的字符串。允许的值:
注释:在 PHP 5.4 更早版本,无法被识别的字符集将被忽略并由 ISO-8859-1 代替。自 PHP 5.4 起,无法被识别的字符集将被忽略并由 UTF-8 代替。 |
试试下面的实例,使用 HTML_SPECIALCHARS 的转换表:
<?php //使用 HTML_SPECIALCHARS 的转换表 print_r (get_html_translation_table(HTML_SPECIALCHARS)); ?>测试看看‹/›
输出结果
Array ( ["] => " [&] => & [<] => < [>] => >> )