传统的HTML块转义。
原型
wp_specialchars( string $string, string $quote_style = ENT_NOQUOTES, false|string $charset = false, false $double_encode = false )
参数
$string
(string)
(Required)
要转义的字符串。
$quote_style
(string)
(Optional)
没用过。
$charset
(false|string)
(Optional)
没用过。
$double_encode
(false)
(Optional)
是否双重编码。没用过。
返回值
(string)
转义
源文件
路径:wp-includes/deprecated.php
<?php
...
function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
_deprecated_function( __FUNCTION__, '2.8.0', 'esc_html()' );
if ( func_num_args() > 1 ) { // Maintain back-compat for people passing additional arguments.
$args = func_get_args();
return call_user_func_array( '_wp_specialchars', $args );
} else {
return esc_html( $string );
}
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/wp_specialchars/