Home > Article > Backend Development > Detailed introduction to PHP common function strip_tags
This article mainly introduces the relevant information on the detailed explanation of the PHP function strip_tags to handle string defect bugs. Friends in need can refer to it
Detailed explanation of the PHP function strip_tags to handle string defect bugs
PHP function strip_tags() is a commonly used function, which can strip HTML, XML and PHP tags from strings. It greatly facilitates the operation of strings, but the strip_tags() function has bugs. Since strip_tags() cannot verify incomplete or damaged HTML tags, more data will be deleted.
Example:
##
$str = '<p>string</p>string<string<b>hello</b><p>string</p>'; echo strip_tags($str, '<p>');Output:
<p>string</p>stringFilter a4b561c25d9afb9ac8dc4d70affff419 tags through the strip_tags function. In fact, I hope to get the following result:
<p>string</p>stringAs a result, we failed to get the expected result. In fact, Because of the angle bracket to the left of the third string in the string, the strip_tags function accidentally deleted other characters.string
The above is the detailed content of Detailed introduction to PHP common function strip_tags. For more information, please follow other related articles on the PHP Chinese website!