The phpstrip_tags () function removes HTML, XML, and PHP tags from strings and returns the strings after the tags are removed. However, you need to pay attention to the details when using the phpstrip_tags () function, when phpstrip_tags () function is used, if the HTML tag is incomplete or damaged, more data will be deleted. This article will introduce the consequences of using the strip_tags () function to remove incomplete HTML tags. Let's take a look. The php strip_tags () function removes HTML, XML, and PHP tags from strings and returns the strings after the tags are removed. However, you need to pay attention to the details when using the php strip_tags () function, when the php strip_tags () function is used, if the HTML tag is incomplete or damaged, more data will be deleted. This article will introduce the consequences of using the strip_tags () function to remove incomplete HTML tags. Let's take a look.
The following example shows the code:
stringstring-1
hello
string-2
";$tags=strip_tags($name,'
');echo $tags;?>
Use strip_tags ($ name ,'
') Filter. we may expect the following results:
What is the cause? You carefully observe the variable $ name in the above code and find that a tag in the $ name string is incomplete because the strip_tags () function cannot actually verify the integrity of the HTML tag, if the HTML tag is incomplete, more data will be deleted. Therefore, you must pay attention to this when using the php strip_tags () function.
[Recommended related articles]
Detailed description of the strip_tags () function example for removing string tags from php
Use the php strip_tags () function to keep multiple HTML tag instances
The above is a detailed description that requires attention when using the php strip_tags () function. For more information, see other related articles in the first PHP community!