关于在ecshop中过滤HTML字段

2016-09-11 20:39 来源:www.chinab4c.com 作者:ecshop专家

function text_html($txt){ //过滤掉html标记
        $txt = str_replace("  "," ",$txt);
        $txt = str_replace("<","<",$txt);
        $txt = str_replace(">",">",$txt);
        $txt = preg_replace("/[ ]{1,}/isu","
",$txt);
        return $txt;
}
 
function clearhtml($str){ //清除调html标记
        $str = str_replace('<','<',$str);
        $str = str_replace('>','>',$str);
        return $str;
}