PHP HTML markup To remove the original function of the explanation, PHP tag function in detail
Strip_tags removes HTML and PHP markup. Syntax: string strip_tags (String str); Return value: String function type: Data processing content Description This function removes any HTML and PHP tag strings contained in the string. If the string of HTML and PHP tag is wrong, for example, less than the symbol, it will also return the wrong
Strip_tags
Remove the HTML and PHP tags.
Syntax: string strip_tags (String str);
return value: String
Function type: Data processing
Content Description
This function removes any HTML and PHP tag strings contained in the string. If the string of HTML and PHP tags are wrong, for example, less than the symbol, it will also return errors. The function and FGETSS () have the same functions.
Htmlspecialchars
Converts special characters to HTML format.
Syntax: String htmlspecialchars (String string);
return value: String
Function type: Data processing
This function converts special characters to HTML string format (&....;). The most commonly used occasion may be to deal with the message of the customer message version.
& (and) turn into &
"(double quotation marks) to turn"
< (less than) turn into <
> (greater than) turn into >
This function converts only the above special characters, and does not convert all of the ASCII conversions that are determined by the HTML.
usage Examples
Copy the Code code as follows:
<?php
$new = Htmlspecialchars ("Test", ent_quotes);
Echo $new;
?>
Attach an example of an application in my project:
When the database is stored in the MySQL database will escape the special symbol, then we will be escaped when reading, and I need to n_info the project to remove the HTML tag, and then intercept 60 characters to display the content
This thought that the direct use of strip_tags () can be achieved, the actual use of the time only found because the database content is escaped, strip_tags is not recognized, so you need to first escape the special characters back,
Specific code: _SUBSTR (Strip_tags (Htmlspecialchars_decode ($value [' N_info '])), 0, 60)
http://www.bkjia.com/PHPjc/948409.html www.bkjia.com true http://www.bkjia.com/PHPjc/948409.html techarticle PHP HTML Markup To remove the original function of the details, PHP tag function in detail strip_tags remove HTML and PHP markup. Syntax: string strip_tags (String str); Return value: String function type: Capital ...