男女疯狂一边摸一边做羞羞视频|啊好深好硬快点用力别停动态图|亚洲一区无码中文字幕|特级无码毛片免费视频播放▽|久久狠狠躁免费观看|国内精品久久久久久网站

get_html_translation_table

(PHP 4, PHP 5, PHP 7, PHP 8)

get_html_translation_table返回使用 htmlspecialchars()htmlentities() 后的轉換表

說(shuō)明

get_html_translation_table(int $table = HTML_SPECIALCHARS, int $flags = ENT_COMPAT | ENT_HTML401, string $encoding = 'UTF-8'): array

get_html_translation_table() 將返回 htmlspecialchars()htmlentities() 處理后的轉換表。

注意:

特殊字符可以使用多種轉換方式。 例如: " 可以被轉換成 ", " 或者 &#x22. get_html_translation_table() 返回其中最常用的。

參數

table

有兩個(gè)新的常量 (HTML_ENTITIES, HTML_SPECIALCHARS) 允許你指定你想要的表。

flags

A bitmask of one or more of the following flags, which specify which quotes the table will contain as well as which document type the table is for. The default is ENT_COMPAT | ENT_HTML401.

Available flags constants
Constant Name Description
ENT_COMPAT Table will contain entities for double-quotes, but not for single-quotes.
ENT_QUOTES Table will contain entities for both double and single quotes.
ENT_NOQUOTES Table will neither contain entities for single quotes nor for double quotes.
ENT_HTML401 Table for HTML 4.01.
ENT_XML1 Table for XML 1.
ENT_XHTML Table for XHTML.
ENT_HTML5 Table for HTML 5.

encoding

Encoding to use. If omitted, the default value for this argument is ISO-8859-1 in versions of PHP prior to 5.4.0, and UTF-8 from PHP 5.4.0 onwards.

支持以下字符集:

支持的字符集列表
字符集 別名 描述
ISO-8859-1 ISO8859-1 西歐,Latin-1
ISO-8859-5 ISO8859-5 Little used cyrillic charset (Latin/Cyrillic).
ISO-8859-15 ISO8859-15 西歐,Latin-9。增加歐元符號,法語(yǔ)和芬蘭語(yǔ)字母在 Latin-1(ISO-8859-1) 中缺失。
UTF-8   ASCII 兼容的多字節 8 位 Unicode。
cp866 ibm866, 866 DOS 特有的西里爾編碼。本字符集在 4.3.2 版本中得到支持。
cp1251 Windows-1251, win-1251, 1251 Windows 特有的西里爾編碼。本字符集在 4.3.2 版本中得到支持。
cp1252 Windows-1252, 1252 Windows 特有的西歐編碼。
KOI8-R koi8-ru, koi8r 俄語(yǔ)。本字符集在 4.3.2 版本中得到支持。
BIG5 950 繁體中文,主要用于中國臺灣省。
GB2312 936 簡(jiǎn)體中文,中國國家標準字符集。
BIG5-HKSCS   繁體中文,附帶香港擴展的 Big5 字符集。
Shift_JIS SJIS, 932 日語(yǔ)
EUC-JP EUCJP 日語(yǔ)
MacRoman   Mac OS 使用的字符串。
''   An empty string activates detection from script encoding (Zend multibyte), default_charset and current locale (see nl_langinfo() and setlocale()), in this order. Not recommended.

注意: 其他字符集沒(méi)有認可。將會(huì )使用默認編碼并拋出異常。

返回值

將轉換表作為一個(gè)數組返回。

更新日志

版本 說(shuō)明
5.4.0 The default value for the encoding parameter was changed to UTF-8.
5.4.0 The constants ENT_HTML401, ENT_XML1, ENT_XHTML and ENT_HTML5 were added.
5.3.4 The encoding parameter was added.

范例

示例 #1 Translation Table Example

<?php
var_dump
(get_html_translation_table(HTML_ENTITIESENT_QUOTES ENT_HTML5));
?>

以上例程的輸出類(lèi)似于:

array(1510) {
  ["
"]=>
  string(9) "&NewLine;"
  ["!"]=>
  string(6) "&excl;"
  ["""]=>
  string(6) "&quot;"
  ["#"]=>
  string(5) "&num;"
  ["$"]=>
  string(8) "&dollar;"
  ["%"]=>
  string(8) "&percnt;"
  ["&"]=>
  string(5) "&amp;"
  ["'"]=>
  string(6) "&apos;"
  // ...
}

參見(jiàn)

男女疯狂一边摸一边做羞羞视频|啊好深好硬快点用力别停动态图|亚洲一区无码中文字幕|特级无码毛片免费视频播放▽|久久狠狠躁免费观看|国内精品久久久久久网站