PHP _php tutorial for filtering and processing methods for submitting special characters to forms

Source: Internet
Author: User
PHP about the form to submit special character processing method to do a summary, mainly related to Htmlspecialchars/addslashes/stripslashes/strip_tags/mysql_real_escape_ A number of functions such as String are used together to communicate with everyone.

One, several PHP functions related to special character processing

Name of function

Interpretation

Introduced

Htmlspecialchars

Combine with, single double quotes, greater than, and less than sign into HTML format

& Turn Into &
"Turn into"
' Turn into '
<>
> Turn into >

Htmlentities ()

All characters are converted to HTML format

In addition to the above Htmlspecialchars characters, the double-byte characters are displayed as encodings.




Addslashes

Single double quote, backslash, and null plus backslash escape

The characters that are changed include single quotation marks ('), double quotation marks ("), backslash backslash (\), and null character null.

Stripslashes

Remove backslash characters

Removes the backslash character from the string. If you have two consecutive backslashes, remove one and leave one. If there is only one backslash, remove it directly.




Quotemeta

Add Reference symbol

The string that contains the. \\ + * ? [ ^ ] ($) to precede the character with the backslash "\" symbol.

NL2BR ()

Converts a newline character to


Strip_tags

Remove HTML and PHP tags

Remove any HTML tags and PHP tags from the string, including the content between tags blocking. Note that if there is an error in the string HTML and PHP tags, an error will also be returned.

Mysql_real_escape_string

Escaping special characters in SQL strings

Escaped \x00 \ r \ n space \ ' "\x1a, which is useful for multibyte character processing. Mysql_real_escape_string will judge the character set, mysql_escape_string do not consider it.

http://www.bkjia.com/PHPjc/825222.html www.bkjia.com true http://www.bkjia.com/PHPjc/825222.html techarticle php about the form to submit special character processing method to do a summary, mainly related to Htmlspecialchars/addslashes/stripslashes/strip_tags/mysql_real_escape_ Several functions, such as String, are used in conjunction with ...

  • 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.