/*
** 过滤一些脏词汇
** $words 脏词汇列表
** $replace 要替换成的词汇
** 返回替换完的词汇
*/
function replace_danger_word($content){
$words=array(‘妈的‘,‘sb‘,‘我靠‘);
$replace =‘*‘;
foreach($words as $key=>$word){
$content=str_replace($word,$replace,$content);
}
return $content;
}
/*
** 过滤一些js字符
** $string 要传入的字符
** 返回替换完的词汇
*/
function stripscript($string){
$pregfind=array("/<script.*>.*<\/script>/siU",‘/on(mousewheel|mouseover|click|load|onload|submit|focus|blur)="[^"]*"/i‘);
$pregreplace=array(‘‘,‘‘,);
$string=preg_replace($pregfind,$pregreplace,$string);
return $string;
}
php过滤一些脏词汇
最新推荐文章于 2024-06-17 09:46:41 发布