PHP htmlspecialchars, Strip_tags, addslashes is a common function in Web page program development, today to detail the use of these functions:
1. Function Strip_tags: Remove HTML and PHP tags
Note: This function removes any HTML and PHP tag strings contained in the string. If the HTML and PHP tags of the string are wrong, such as less than the symbol greater than, it will return the error. This function has the same function as FGETSS (). Fgetss reads files from a file and removes HTML and PHP tags.
2. function htmlspecialchars, converting special characters into HTML format
Specifically, this function converts the following characters:
& (and) Convert to &
"(double quotes) into"
< (less than) turn into <
> (greater than) convert to >
3. function Htmlentities, turn all the characters into HTML strings
Maybe you're still sorry. Htmlspecialchars can only handle 4 HTML tags, so now you don't regret it, htmlentities is converting all the characters. It's not as strong as it seems, but it doesn't seem to be very meaningful to me.
4. Function stripslashes and addslashes are a pair, addslashes refers to a string using backslashes, Stripslashes is a string that restores addslashes references.
This function is typically a necessary step before a database query, which is preceded by a backslash for the needs of database query statements. These characters are single quotes ('), double quotes ("), backslashes (/) and NUL (NULL characters).