wp_kses_no_null()
wp_kses_no_null( string $string, array $options = null …
wp_kses_no_null( string $string, array $options = null )
删除文本字符串中的所有无效控制字符。
Removes any invalid control characters in a text string.
目录锚点:#说明#参数#源码
说明(Description)
同时删除 字符串的任何实例。
参数(Parameters)
| 参数 | 类型 | 说明 |
|---|---|---|
| $string | (string) | 要从中筛选空字符的内容。 |
| $options | (array) | 如果允许“”,则设置“斜杠”=>“保留”。默认为“删除”。 |
源码(Source)
/**
* Removes any invalid control characters in $string.
*
* Also removes any instance of the '' string.
*
* @since 1.0.0
*
* @param string $string
* @param array $options Set 'slash_zero' => 'keep' when '' is allowed. Default is 'remove'.
* @return string
*/
function wp_kses_no_null( $string, $options = null ) {
if ( ! isset( $options['slash_zero'] ) ) {
$options = array( 'slash_zero' => 'remove' );
}
$string = preg_replace( '/[x00-x08x0Bx0Cx0E-x1F]/', '', $string );
if ( 'remove' == $options['slash_zero'] ) {
$string = preg_replace( '/+0+/', '', $string );
}
return $string;
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 1.0.0 | wp-includes/kses.php | 4 | 19 |
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。





还没有任何评论,赶紧来占个楼吧!