esc_textarea

函式
esc_textarea ( $text )
引數
  • (string) $text
    Required:
返回值
  • (string)
定義位置
相關方法
esc_attr_eesc_attrsanitize_textarea_fieldblock_footer_areaesc_attr__
引入
3.1.0
棄用
-

esc_textarea: 這個函式用來轉義一個字串,以便在HTML中的textarea元素中使用。

對文字區域的值進行加長。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function esc_textarea( $text ) {
$safe_text = htmlspecialchars( $text, ENT_QUOTES, get_option( 'blog_charset' ) );
/**
* Filters a string cleaned and escaped for output in a textarea element.
*
* @since 3.1.0
*
* @param string $safe_text The text after it has been escaped.
* @param string $text The text prior to being escaped.
*/
return apply_filters( 'esc_textarea', $safe_text, $text );
}
function esc_textarea( $text ) { $safe_text = htmlspecialchars( $text, ENT_QUOTES, get_option( 'blog_charset' ) ); /** * Filters a string cleaned and escaped for output in a textarea element. * * @since 3.1.0 * * @param string $safe_text The text after it has been escaped. * @param string $text The text prior to being escaped. */ return apply_filters( 'esc_textarea', $safe_text, $text ); }
function esc_textarea( $text ) {
	$safe_text = htmlspecialchars( $text, ENT_QUOTES, get_option( 'blog_charset' ) );
	/**
	 * Filters a string cleaned and escaped for output in a textarea element.
	 *
	 * @since 3.1.0
	 *
	 * @param string $safe_text The text after it has been escaped.
	 * @param string $text      The text prior to being escaped.
	 */
	return apply_filters( 'esc_textarea', $safe_text, $text );
}

常見問題

FAQs
檢視更多 >