当前位置: 首页 > 网络学院 > 服务端脚本教程 > PHP > get_html_translation_table()

PHP
PHP 安全邮件
MySQL 介绍
连接 MySQL
创建 MySQL
MySQL 插入记录
MySQL 选择记录
MySQL Where
MySQL Order By
MySQL 记录更新
MySQL 删除记录
PHP ODBC
XML Expat Parser
XML SimpleXML
PHP 数组参考
PHP Calendar
PHP Date
PHP Directory
PHP Filesystem
PHP FTP
PHP HTTP

PHP 中的 get_html_translation_table()


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 569 ::
收藏到网摘: n/a

Definition and Usage
定义和用法

The get_html_translation_table() function returns the translation table used by the htmlentities() and htmlspecialchars() functions.
get_html_translation_table()函数的作用是:返回htmlspecialchars()函数和htmlentities()函数的转换表。

Syntax
语法

get_html_translation_table(function,quotestyle)

Parameter参数 Description描述
function Optional. Specifies which translation table to return. Default is HTML_SPECIALCHARS.
可选参数。指定返回那个翻译平台

Possible values:
可能值:

  • HTML_ENTITIES - Translates all characters that need URL-encoding to be shown properly on a HTML page
    HTML_ENTITIES –翻译所有的字符。这些字符需要进行URL编码,并以适当的格式显示在HTML页面上
  • HTML_SPECIALCHARS - Translates some characters that need URL-encoding to be shown properly on a HTML page
    HTML_SPECIALCHARS -翻译部分字符。这些字符需要进行URL编码,并以适当的格式显示在HTML页面上
quotestyle Optional. Defines how to encode single and double quotes. Default is ENT_COMPAT
可选参数。定义如何对单引号和双引号进行编码。默认值是ENT_COMPAT。

Possible values:
可能值:

  • ENT_COMPAT - Encodes double quotes, not single quotes
    ENT_COMPAT –对双引号进行编码,不对单引号进行编码
  • ENT_QUOTES - Encodes double and single quotes
    ENT_QUOTES –对单引号和双引号进行编码
  • ENT_NOQUOTES - Does not encode single or double quotes
    ENT_NOQUOTES –不对单引号或双引号进行编码


Tips and Notes
提示

Tip: Some characters can be encoded several ways. The get_html_translation_table() function returns the most common encoding.
提示:部分字符可以通过不同的方式进行编码。get_html_translation_table()函数返回了最通常使用的编码形式。


Example
案例

In this example we will show both translation tables.:
在下面这个案例中,我们将展示两个转换平台:

<?php
print_r (get_html_translation_table());
echo "<br />";
print_r (get_html_translation_table(HTML_ENTITIES));
?>

The output of the code above will be:
上述代码将输出下面的结果:

Array
(
["] => " [<] => < [>] => > [&] => &
)
Array
(
[ ] =>   [¡] => ¡ [¢] => ¢ [£] => £
[¤] => ¤ [¥] => ¥ [¦] => ¦ [§] => §
[¨] => ¨ [©] => © [ª] => ª [«] => «
[¬] => ¬ [­] => ­ [®] => ® [¯] => ¯
[°] => ° [±] => ± [²] => ² [³] => ³
[´] => ´ [µ] => µ [¶] => ¶ [·] => ·
[¸] => ¸ [¹] => ¹ [º] => º [»] => »
[¼] => ¼ [½] => ½ [¾] => ¾ [¿] => ¿
[À] => À [Á] => Á [Â] => Â [Ã] => Ã
[Ä] => Ä [Å] => Å [Æ] => Æ [Ç] => Ç
[È] => È [É] => É [Ê] => Ê [Ë] => Ë
[Ì] => Ì [Í] => Í [Î] => Î [Ï] => Ï
[Ð] => Ð [Ñ] => Ñ [Ò] => Ò [Ó] => Ó
[Ô] => Ô [Õ] => Õ [Ö] => Ö [×] => ×
[Ø] => Ø [Ù] => Ù [Ú] => Ú [Û] => Û
[Ü] => Ü [Ý] => Ý [Þ] => Þ [ß] => ß
[à] => à [á] => á [â] => â [ã] => ã
[ä] => ä [å] => å [æ] => æ [ç] => ç
[è] => è [é] => é [ê] => ê [ë] => ë
[ì] => ì [í] => í [î] => î [ï] => ï
[ð] => ð [ñ] => ñ [ò] => ò [ó] => ó
[ô] => ô [õ] => õ [ö] => ö [÷] => ÷
[ø] => ø [ù] => ù [ú] => ú [û] => û
[ü] => ü [ý] => ý [þ] => þ [ÿ] => ÿ
["] => " [<] => < [>] => > [&] => &
)

评论 (0) All

登陆 | 还没注册?