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 the string defect bug
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>');
<p>string</p>string
<p>string</p>stringstring
The above is the detailed content of Detailed explanation of the shortcomings of the PHP function strip_tags. For more information, please follow other related articles on the PHP Chinese website!