WordPress开发者和主题制作者的搜索引擎



htmlentities2 ›

Since1.2.2
已弃用n/a
htmlentities2 ( $myHTML )
参数:
  • (string) $myHTML The text to be converted.
    Required: Yes
链接:
  • Borrowed from the PHP Manual user notes.
返回:
  • (string) Converted text.
定义在:
文档:

Convert entities, while preserving already-encoded entities.



源码

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) );
}