[php]代码库
function remove_html_tag($str){ //清除HTML代码、空格、回车换行符
//trim 去掉字串两端的空格
//strip_tags 删除HTML元素
$str = trim($str);
$str = @preg_replace('/<script[^>]*?>(.*?)<\/script>/si', '', $str);
$str = @preg_replace('/<style[^>]*?>(.*?)<\/style>/si', '', $str);
$str = @strip_tags($str,"");
$str = @ereg_replace("\t","",$str);
$str = @ereg_replace("\r\n","",$str);
$str = @ereg_replace("\r","",$str);
$str = @ereg_replace("\n","",$str);
$str = @ereg_replace(" ","",$str);
$str = @ereg_replace(" ","",$str);
return trim($str);
}