PHP form submission special character filtering method

Source: Internet
Author: User
Tags php form
This article introduces the way to filter special characters when PHP forms submit data, learn how PHP filters special characters, what character filtering functions, Refer to a friend who needs it. The

PHP form submits special character processing method, mainly uses the htmlspecialchars/addslashes/stripslashes/strip_tags/mysql_real_escape_string and so on several functions.

I. Description of PHP function function names related to special character handling Htmlspecialchars will be the same as, single double quotes, greater than and less than the HTML format & turn into & "turn into" "turn into" to <> turn into >htmlentiti ES () All characters are converted to HTML format in addition to the above Htmlspecialchars characters, also including the double-byte character display as encoding and so on. Addslashes single-double quotes, backslashes, and null plus a backslash escape characters that are modified include single quotation marks ('), double quotation marks ("), backslashes backslash (\), and null characters null. Stripslashes remove the backslash character and remove 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 adds a reference symbol to the string that contains it. \\ + * ? [ ^ ] ($) to precede the character with the backslash "\" symbol. NL2BR () converts the newline character to

Strip_tags removes HTML and PHP tags from any HTML tags and PHP tags in 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 escapes the special character escaping from the SQL string \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. HTML Special characters filter PHP class URL link special character escape method php special characters escape detailed php filter parameter special char anti-injection PHP filter illegal and special string method PHP instance: Special Character Handler example replace PHP code with special characters in extra long text

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