Home >Backend Development >PHP Tutorial >html tag function to delete HTML tags in strings under php
When visitors leave messages and posts, we do not want visitors to use html tags in their messages and posts, so we have to delete the html tags when visitors submit messages and posts. The following function is the function that implements this function
< ?
function delete_htm($scr)
{
for($i=0;$i
if(substr($scr,$i,1)=="< ")
{
while(substr($scr,$i,1)!=">")$i++;
$i++;
}
$str=$str.substr($scr,$i,1) ;
}
return($str);
}
?>
The above introduces the html tag function to delete HTML tags in strings under PHP, including the content of html tags. I hope it will be helpful to friends who are interested in PHP tutorials.