站长资源脚本专栏

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

整理:jimmy2025/1/6浏览2
简介复制代码 代码如下:function DeleteHtml($str) { $str = trim($str); $str = strip_tags($str,""); $str = ereg_replace("\t","",$str); $str = ereg_replace("\r\n","",
复制代码 代码如下:
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);
}

可以根据需要对这个函数进行扩充修改。