函數(shù)esc_js()(過濾 Html 內(nèi)嵌 JS)
參數(shù)
$text
(字符串)(必須)要過濾的字符串。
默認(rèn)值:None
返回值
(字符串)返回過濾后的字符串。
例子
1
|
<input type= "text" value= "<?php echo esc_attr( $instance['input_text'] ); ?>" id= "subbox" onfocus= "if ( this.value == '<?php echo esc_js( $instance['input_text'] ); ?>') { this.value = ''; }" onblur= "if ( this.value == '' ) { this.value = '<?php echo esc_js( $instance['input_text'] ); ?>'; }" name= "email" /> |
更多
此函數(shù)位于:wp-includes/formatting.php
nocache_headers()(禁止瀏覽器緩存)
nocache_headers() 用來發(fā)送一個 header 頭信息,告訴瀏覽器禁止緩存當(dāng)前頁面,一般在 Ajax 請求時使用,防止出現(xiàn)錯誤。
用法
1
|
nocache_headers(); |
屬性
此函數(shù)沒有屬性。
返回值
此函數(shù)無返回值。
例子
1
2
3
4
5
6
|
function Bing_add_ajax(){ nocache_headers(); echo true; die ; } add_action( 'template_redirect' , 'Bing_add_ajax' ); |
其它
此函數(shù)位于:wp-includes/functions.php