php版清除html标签代码片段

php版清除html标签代码片段

$content = preg_replace("/<script[sS]*?</script>/i","",$content,3); //第四个参数中的3表示替换3次,默认是-1,替换全部
$content = preg_replace("/<style[sS]*?</style>/i","",$content,-1);
$content = preg_replace("/<iframe[sS]*?</iframe>/i","",$content,-1);
$content = preg_replace("/<input.*?/>/i","",$content,-1);
$content = preg_replace("/<!--.*?-->/si","",$content,-1);
$content = preg_replace("/<([a-zA-Z]+)[^>]*>/","<1>",$content,-1);//过滤所有html标签的属性