A detailed description of the filter properties in WordPress development and the use of SQL statements, _php Tutorial

Source: Internet
Author: User

A detailed description of the filter properties in WordPress development and the use of SQL statements function,


Esc_attr () (Filter properties)
It is generally written in the following format when writing the tag attributes of the Html code:

What if the Value property is dynamic output?

However, if the dynamic output attributes include double quotes, angle brackets, and other special characters, the Html code will be scrambled, then you can use the esc_attr () function to escape the output properties.

How to use

Esc_attr ($text);

Parameters

$text (String) (must) the string to be escaped. Default value: None

return value

Returns the escaped string.

Example

Other

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

Esc_sql () (Filter SQL statements)
Esc_sql () is used to filter the strings that are prepared to be added to the SQL statement, preventing SQL injection and SQL statements from being disturbed by data.

Usage

Esc_sql ($data);

Parameters

$data

(string) (must) the string to filter.

Default value: None

return value

(string) returns the filtered string, which can be added directly to the SQL statement.

Example

$name = Esc_sql ($name); $status = Esc_sql ($status); $wpdb->get_var ("Select something from table WHERE foo = ' $name ' and status = ' $status ');

More

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


Articles you may be interested in:

    • WordPress to determine whether the user is logged in the code
    • Detailed description of WordPress in the reminder to install plug-ins and hidden plug-in function implementation
    • Add a code instance to the edit background of WordPress
    • PHP function parsing for writing custom storage fields in WordPress
    • A detailed description of the PHP functions used to create user roles in WordPress

http://www.bkjia.com/PHPjc/1084527.html www.bkjia.com true http://www.bkjia.com/PHPjc/1084527.html techarticle A detailed description of the filter properties in WordPress development and the use of functions of SQL statements, Esc_attr () (Filter properties) is generally written in the Html code of the tag attribute will be the following format: input ty ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.