宗的博客

导航

PHP 清除HTML代码、空格、回车换行符的函数

function DeleteHtml($str)
{
$str = trim($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);
return trim($str);
}

posted on 2009-11-20 09:00  wrz  阅读(954)  评论(0编辑  收藏  举报