Home >php教程 >php手册 >php下删除字符串中HTML标签的函数

php下删除字符串中HTML标签的函数

WBOY
WBOYOriginal
2016-06-13 12:26:51960browse

当访客留言和发帖时,我们并不希望访客在留言和帖子中使用html标记,所以在访客提交留言和帖子时我门得把html标记删除,下面的函数就是实现此功能的函数

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);
}
?>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn