函数esc_js()(过滤 html 内嵌 js)
参数
$text
(字符串)(必须)要过滤的字符串。
默认值:none
返回值
(字符串)返回过滤后的字符串。
例子
<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" />
更多
此函数位于:wp-includes/formatting.php
nocache_headers()(禁止浏览器缓存)
nocache_headers() 用来发送一个 header 头信息,告诉浏览器禁止缓存当前页面,一般在 ajax 请求时使用,防止出现错误。
用法
nocache_headers();
属性
此函数没有属性。
返回值
此函数无返回值。
例子
function bing_add_ajax(){
nocache_headers();
echo true;
die;
}
add_action( 'template_redirect', 'bing_add_ajax' );
其它
此函数位于:wp-includes/functions.php
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!