Many times, some text is fetched from a third party, and an escape error occurs. Now summarize some of the escape functions that PHP comes with, as shown in
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. |
Base64_decode |
Base64 decoding |
Decoding data encoded with MIME base64 |
Base64_encode |
Base64 encoding |
Encode data using MIME base64 |
UrlDecode |
URL decoding |
Decodes an encoded URL string |
UrlEncode |
URL encoding |
Encoded URL string |
'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
'). Text (i)); }; $numbering. FadeIn (1700); }); });
The above describes the PHP escape character, including the contents of the content, I hope that the PHP tutorial interested in a friend helpful.