作者:辉 | 来源:互联网 | 2018-07-17 13:38
ec(2);*----------------------过滤HTML代码的函数-----------------------*functionhtmlEncode($string){ $stringtrim($string); $stringstr_replace("
*----------------------
过滤HTML代码的函数
-----------------------*/
function htmlEncode($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;
}