Strip_tags get rid of HTML and PHP tags. Syntax: string strip_tags (String str); Return value: String function type: Data processing content Description This function can remove any HTML and PHP tag strings contained in the string. If the HTML of the string and PHP tags are original error, such as less than the symbol is greater than, it will return the wrong
Strip_tags
Get rid of HTML and PHP tags.
Syntax: string strip_tags (String str);
return value: String
Types of functions: Data processing
Content Description
This function can remove 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 and FGETSS () have the same functionality.
Htmlspecialchars
Converts a special character into HTML format.
Syntax: String htmlspecialchars (String string);
return value: String
Types of functions: Data processing
This function converts a special character into an HTML string format (&....;). The most commonly used occasions may be to deal with the message version of the customer message.
& (and) Convert to &
"(double quotes) into"
< (less than) turn into <
> (greater than) convert to >
This function converts only the special characters above, and does not convert all to the ASCII conversion specified by HTML.
usage Examples
Copy Code code as follows:
<?php
$new = Htmlspecialchars ("<a href= ' test ' >Test</a>", ent_quotes);
Echo $new;
?>
Attached is an application example in my project:
In the database when the MySQL database will escape the special symbols, then we will be escaped when reading, and my project needs to n_info the contents of the field first remove HTML tags, and then intercept 60 characters of the content displayed
This thought that the direct use of strip_tags () can be achieved, the actual use of the time to find because the contents of the database is escaped, strip_tags is not recognized, so you need to first special words escape back,
Specific code: _SUBSTR (Strip_tags (Htmlspecialchars_decode ($value [' n_info ']), 0, 60)