Php implements the html tag filtering method in form submission. Php implements the html tag filtering method in form submission. sometimes some html tags are submitted in the simple comment function, which may cause some external connections to the page, php: how to filter html tags in form submission
Sometimes the simple comment function we make will find that many html tags are submitted, which may cause some external connections to the page, let's take a look at the html tag method used to filter form submissions in php.
Some post links submitted by robots in recent comments are all spam comments. To reduce the unnecessary link content, you can use php to delete the html tag submitted by form POST, so that the information submitted by the machine will not get the expected result. In addition, it can reduce penalties from seo/seo.html "target =" _ blank "> search engines.
Remove it here
Tag:
In some cases, we need to remove
Tag. you can use the str_replace function.
The code is as follows:
// Retrieve the br Mark
$ Str = str_replace ("
"," ", $ Str );
Remove html tags:
You can use the strip_tags function.
The code is as follows:
$ Str = strip_tags ($ str );
Encapsulated into a function:
The code is as follows:
Function removehtml ($ str ){
$ Str = str_replace ("
"," ", $ Str );
Return strip_tags ($ str );
}
?>
Sometimes, when we make a simple comment, we will find that many html tags are submitted. these tags will cause some external connections to the page ,...