首页 >php教程 >php手册 >PHP的一个字符过滤函数

PHP的一个字符过滤函数

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB原创
2016-06-21 09:05:561204浏览

函数

function safe_convert($string$html=0) { //Words Filter
    
if ($html==0
) {
        
$string=htmlspecialchars($stringENT_QUOTES
);
        
$string=str_replace(",",$string
);
        
$string=str_replace(">",">",$string
);
        
$string=str_replace("\\"'\'$string
);
    } else {
        
$string=addslashes($string
);
        
$string=str_replace("\\\\"'\'$string
);
    }
    
$string=str_replace("\r","
"
,$string
);
    
$string=str_replace("\n","",$string
);
    
$string=str_replace("\t","  ",$string
);
    
$string=str_replace("  ","  ",$string
);
    
$string=str_replace('|''|'$string
);
    
$string=str_replace("`","`",$string
);
    
$string=str_replace("\","\",$string
);
    return 
$string
;



声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn