Sometimes when we do a simple comment function, we will find that a lot of html tags are submitted, and these tags will cause the page to have some extraneous features. In the case of connection, let's take a look at the html tag method of filtering form submission in PHP.
There have been some post links submitted by robots in recent comments, which are all spam comments. In order to reduce the appearance of this unnecessary link content, you can actually use php to delete the html tags submitted by the form POST, so that the information submitted by the machine will not get the results they want. And it can reduce penalties from seo/seo.html" target="_blank">search engines.
Here is an example of removing the
tag:
In some cases we need to remove the
tag, we can use the str_replace function.
The code is as follows:
Remove html tag:
This can be done using the strip_tags function.
Copy the code The code is as follows:
Encapsulated into a function:
The code is as follows: