PHP Implementation method to filter the HTML tags in the form submission
Sometimes we do a simple comment function will find that there are a lot of HTML tags submitted, these labels will cause the page to have some external connection, let's look at the HTML tag method of filtering form submission in PHP.
Some of the post links submitted by robots in recent reviews are spam reviews. In order to reduce this unnecessary link content appears, actually can use PHP to delete the form post submission HTML tag, so the machine submits the information also does not have the result which they want. And can reduce the penalty from seo/seo.html "target=" _blank "> Search engine.
Here to remove
Label For example:
In some cases we need to remove
tag, you can use the Str_replace function.
The code is as follows:
Remove BR Mark
$str =str_replace ("
"," ", $str);
To remove an HTML tag:
It can be done using the Strip_tags function.
Copy the code code as follows:
$str = Strip_tags ($STR);
Encapsulated as a function:
The code is as follows:
function removehtml ($STR) {
$str =str_replace ("
"," ", $str);
Return Strip_tags ($STR);
}
?>
http://www.bkjia.com/PHPjc/896779.html www.bkjia.com true http://www.bkjia.com/PHPjc/896779.html techarticle PHP Implementation method of filtering the HTML tags in the form submission sometimes we do a simple comment function will find that there are many submitted HTML tags, these tags will cause the page has some external connection, ...