函数原型
htmlentities2( string $myHTML ): string
函数描述
Converts entities, while preserving already-encoded entities.
是否弃用
未弃用
函数参数
-
$myHTML
string
Required - The text to be converted.
函数返回值
string Converted text.
函数位置
File: wp-includes/formatting.php.
函数源码
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 ) );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 1.2.2 | Introduced. |

