WordPress tips on using two PHP functions when debugging front-end pages, _PHP tutorial

WBOY
Release: 2016-07-12 09:02:36
Original
805 people have browsed it

WordPres uses tips for two PHP functions when debugging front-end pages,

Function esc_js() (filtering Html embedded JS)
Parameters

$text

(String) (Required) The string to filter.

Default value: None

Return value

(String) Returns the filtered string.

Example

<input type="text" value="<&#63;php echo esc_attr( $instance['input_text'] ); &#63;>" id="subbox" onfocus="if ( this.value == '<&#63;php echo esc_js( $instance['input_text'] ); &#63;>') { this.value = ''; }" onblur="if ( this.value == '' ) { this.value = '<&#63;php echo esc_js( $instance['input_text'] ); &#63;>'; }" name="email" />

Copy after login

More

This function is located at: wp-includes/formatting.php

nocache_headers() (disable browser caching)
nocache_headers() is used to send a header information to tell the browser to disable caching of the current page. It is generally used during Ajax requests to prevent errors.

Usage

nocache_headers();
Copy after login

Properties

This function has no attributes.

Return value

This function has no return value.

Example

function Bing_add_ajax(){
  nocache_headers();
  echo true;
  die;
}
add_action( 'template_redirect', 'Bing_add_ajax' );
Copy after login

Others

This function is located at: wp-includes/functions.php

Articles you may be interested in:

  • Introduction to several plug-ins that optimize the JavaScript loading experience in WordPress
  • Quickly master the method of loading JavaScript scripts in WordPress
  • Methods to use JavaScript to implement the secondary navigation menu in WordPress
  • Four ways to use js code and plug-ins to achieve the snowflake falling effect in wordpress
  • Introduction to research on the js library collection of wordpress

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1084561.htmlTechArticleWordPres uses tips for two PHP functions when debugging front-end pages, function esc_js() (filter Html embedded JS) Parameter $text (string) (required) The string to filter. Default...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template