Home  >  Article  >  Backend Development  >  Introduction to PHP strip_tags() to remove HTML, XML and PHP tags

Introduction to PHP strip_tags() to remove HTML, XML and PHP tags

高洛峰
高洛峰Original
2017-01-03 09:29:301105browse

Syntax: strip_tags(string,allow);
string is required and specifies the string to be checked.
allow is optional and specifies allowed tags. These tags will not be deleted.
Comment: This function will always strip HTML comments, which cannot be changed through the allow parameter.

Example:
$str = "Hello world!";
echo strip_tags( $str);
echo '
';
echo strip_tags($str, '');
?>
Output result:
Hello world!
Hello world!


For more PHP strip_tags() removal of HTML, XML and PHP tags, please pay attention to the PHP Chinese website for related articles!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]