You can use the built-in "strip_tags" function in php to clear tags. This function always strips HTML comments. Its syntax is "strip_tags(string,allow)". The parameter "string" represents the character to be checked. string.
Recommended: "PHP Tutorial"
strip_tags definition and usage
# The ##strip_tags() function strips HTML, XML and PHP tags from strings. Comments: This function always strips HTML comments. This cannot be changed via the allow parameter. Note: This function is binary safe. Syntaxstrip_tags(string,allow)
<?php echo strip_tags("Hello <b><i>world!</i></b>","<b>"); ?>
The above is the detailed content of How to clear tags in php. For more information, please follow other related articles on the PHP Chinese website!