js_escape

函式
js_escape ( $text )
引數
  • (string) $text The text to be escaped.
    Required:
返回值
  • (string) Escaped text.
相關
  • esc_js()
定義位置
相關方法
tag_escapelike_escapeshow_messageattribute_escapeesc_attr_e
引入
2.0.4
棄用
2.8.0

js_escape: 這是WordPress中的一個函式,用於轉義一個字串,以便在JavaScript中使用。它可以用來防止包括使用者輸入的JavaScript程式碼中的錯誤或安全漏洞。

轉化單引號,特殊符號雙引號,並修復行尾。

過濾器{@see ‘js_escape’}也被esc_js()應用。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function js_escape( $text ) {
_deprecated_function( __FUNCTION__, '2.8.0', 'esc_js()' );
return esc_js( $text );
}
function js_escape( $text ) { _deprecated_function( __FUNCTION__, '2.8.0', 'esc_js()' ); return esc_js( $text ); }
function js_escape( $text ) {
	_deprecated_function( __FUNCTION__, '2.8.0', 'esc_js()' );
	return esc_js( $text );
}

常見問題

FAQs
檢視更多 >