Home > Backend Development > PHP Tutorial > WordPress tips on using two PHP functions when debugging front-end pages

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

WBOY
Release: 2016-07-29 09:09:39
Original
767 people have browsed it

Function esc_js() (filter Html embedded JS)
Parameters

$text

(string) (required) The string to be filtered.

Default value: None

Return value

(String) Returns the filtered string.

Example

<input type="text" value="<&#63;php echo esc_attr( $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 header information to tell the browser to prohibit Cache the current page, generally used during Ajax requests to prevent errors.

Usage

nocache_headers();
Copy after login

Attributes

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

The above introduces two tips for using PHP functions when debugging front-end pages in WordPress, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

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