htmlentities2

函式
htmlentities2 ( $myHTML )
引數
  • (string) $myHTML The text to be converted.
    Required:
返回值
  • (string) Converted text.
定義位置
相關方法
wp_htmledit_precomment_timeget_comment_timeget_sitesthe_title
引入
1.2.2
棄用
-

htmlentities2 – 這是一個PHP函式,將特殊字元轉換為相應的HTML實體。HTML實體是用於在HTML和XML文件中表示特殊字元的程式碼,如引號、安培號和重音。htmlentities2函式類似於內建的htmlentities函式,但它也可以轉換標準ASCII字符集所不能識別的字元。

轉換實體,同時保留已經編碼的實體。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function htmlentities2( $myHTML ) {
$translation_table = get_html_translation_table( HTML_ENTITIES, ENT_QUOTES );
$translation_table[ chr( 38 ) ] = '&';
return preg_replace( '/&(?![A-Za-z]{0,4}w{2,3};|#[0-9]{2,3};)/', '&', strtr( $myHTML, $translation_table ) );
}
function htmlentities2( $myHTML ) { $translation_table = get_html_translation_table( HTML_ENTITIES, ENT_QUOTES ); $translation_table[ chr( 38 ) ] = '&'; return preg_replace( '/&(?![A-Za-z]{0,4}w{2,3};|#[0-9]{2,3};)/', '&', strtr( $myHTML, $translation_table ) ); }
function htmlentities2( $myHTML ) {
	$translation_table              = get_html_translation_table( HTML_ENTITIES, ENT_QUOTES );
	$translation_table[ chr( 38 ) ] = '&';
	return preg_replace( '/&(?![A-Za-z]{0,4}w{2,3};|#[0-9]{2,3};)/', '&', strtr( $myHTML, $translation_table ) );
}

常見問題

FAQs
檢視更多 >