欢迎来到福编程网,本站提供各种互联网专业知识!

php下过滤HTML代码的函数

发布时间:2007-12-10 作者: 来源:转载
/*----------------------过滤HTML代码的函数-----------------------*/functionhtmlEncode($string){$string=trim($string);$string=str_replace("&","&",$string);$string=str_replace("'","'",$string);$string=str_replace("&","&",
/*----------------------
过滤HTML代码的函数
-----------------------*/
functionhtmlEncode($string){
$string=trim($string);
$string=str_replace("&","&",$string);
$string=str_replace("'","'",$string);
$string=str_replace("&","&",$string);
$string=str_replace(""",""",$string);
$string=str_replace(""",""",$string);
$string=str_replace("<","<",$string);
$string=str_replace("<","<",$string);
$string=str_replace(">",">",$string);
$string=str_replace(">",">",$string);
$string=str_replace("","",$string);
$string=nl2br($string);
return$string;
}

相关推荐