PHP on the form to submit special characters of the processing method to do a summary, mainly related to Htmlspecialchars/addslashes/stripslashes/strip_tags/mysql_real_escape_ Several functions, such as String, are used jointly to communicate with others.
One or several PHP functions related to special character processing
The name of the function |
Interpretation |
Introduced |
Htmlspecialchars |
Converts to HTML format with, single double quotes, greater than and less than |
& Turn & "Turn" ' Turn ' < Turn < > Turn > |
Htmlentities () |
All characters are converted to HTML format |
In addition to the above Htmlspecialchars characters, also include double-byte characters to display the encoding and so on. |
|
|
|
Addslashes |
Single double quotes, backslash and null plus backslash escape |
The changed characters include single quotation marks ('), double quotes ("), backslash backslash (\), and null character nulls. |
Stripslashes |
Remove backslash characters |
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 |
Add Reference symbol |
Contains the string. \\ + * ? [ ^ ] ($) Precede the character with the backslash "\" symbol. |
NL2BR () |
Convert newline characters to
|
|
Strip_tags |
Remove HTML and PHP tags |
Remove any HTML tags and PHP tags from the string, including marking the contents between the blocking. Note If there are errors in the string HTML and PHP tags, an error is returned. |
Mysql_real_escape_string |
Escape a special character in a SQL string |
The escape \x00 \ r \ n space \ ' "\X1A is effective for multibyte character processing. Mysql_real_escape_string will judge the character set, and mysql_escape_string is not to be considered. |