This article mainly introduces about PHP strip_tags() stripping HTML tags in strings. It has certain reference value. Now I share it with you. Friends in need can refer to
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.
strip_tags(string,allow)
Parameter Description
string Required. Specifies the string to check.
allow Optional. Specifies allowed tags. These tags will not be deleted.
<!DOCTYPE html><html><body><?phpecho strip_tags("Hello <b>world!</b>");echo strip_tags("Hello <b>world!</b>", "<b>");?></body></html>#展示 Hello world! Hello world!
Related recommendations:
Instance analysis of strip_tags() in php only filters a certain tag in the string
The above is the detailed content of PHP strip_tags() strips HTML tags from a string. For more information, please follow other related articles on the PHP Chinese website!