Home > Backend Development > PHP Tutorial > 一个可以删除字符串中HTML标记的PHP函数

一个可以删除字符串中HTML标记的PHP函数

WBOY
Release: 2016-06-01 14:31:45
Original
721 people have browsed it
一个可以删除字符串中HTML标记的PHP函数
作者:limote


当访客留言和发帖时,我们并不希望访客在留言和帖子中使用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);
}
?>
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template