(Filter and Escape) PHP comes with filter and escape functions

Source: Internet
Author: User
Tags base64

Name of function

Use Note
Htmlspecialchars

will be with &&, single and double quotes ' ",

Greater than >, less than < turns into HTML format

&&->&amp

'->& #039

"->&quot

<->&lt

>->&gt

Htmlentities Turn all characters into HTML format Except with &&, single and double quotes '/',

Greater than >, less than <, and also includes double-byte character display as encoding, etc.

Addslashes

Place single double quote ' ", backslash backslash\, NULL

Plus backslash \ Escape

\‘

\"

\\

\null

Stripslashes Remove backslash characters

Remove the backslash character in the string, if two consecutive,

Then remove a

Quotemeta Add Reference symbol

The string that contains the. \\ + * ? [ ^ ] ($) and other characters.

preceded by a backslash \ Symbol

Nl2br Turn line break \ n to <br> <br> for HTML format
Strip_tags Remove HTML and PHP tags

Remove any HTML and PHP tags from the string, including tags

Content, note that if there are errors in the string HTML and PHP tags, it will also

return error

Mysql_real_escape_string Escaping special characters in SQL strings Escape \x00 \ r \ n space \ ' "\x1a, which is useful for multibyte character processing, which determines the character set, mysql_escape_string does not consider
Base64_decode Base64 decoding Decoding data that uses MIME base64 encoding

Base64_encode

Base64 encoding Encode data using MIME base64
Rawurldecode URL decoding Decoding an encoded URL string
Rawurlencode URL encoding Encode URLs according to RFC 1738
UrlDecode URL decoding Decodes an encoded URL string
UrlEncode URL encoding Encoded URL string

(Filter and Escape) PHP comes with filter and escape functions

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.