wp_kses_no_null

函式
wp_kses_no_null ( $string, $options = null )
引數
  • (string) $string Content to filter null characters from.
    Required:
  • (array) $options Set 'slash_zero' => 'keep' when '\0' is allowed. Default is 'remove'.
    Required:
    Default: null
返回值
  • (string) Filtered content.
定義位置
相關方法
wp_kses_postwp_kses_versionwp_kses_hookwp_kses_one_attrwp_kses_array_lc
引入
1.0.0
棄用
-

wp_kses_no_null: 此函式用於從字串中刪除空字元。

刪除文字字串中任何無效的控制字元。

同時刪除任何“字串的例項。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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;
}
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; }
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;
}

常見問題

FAQs
檢視更多 >