peibaishi 发表于 2017-4-5 07:59:57

PHP 过滤HTML代码空格,回车换行符的函数

function deletehtml($str)
{
$str = trim($str);
$str=strip_tags($str,"");
$str=preg_replace("{\t}","",$str);
$str=preg_replace("{\r\n}","",$str);
$str=preg_replace("{\r}","",$str);
$str=preg_replace("{\n}","",$str);
$str=preg_replace("{ }","",$str);
return $str;
}
页: [1]
查看完整版本: PHP 过滤HTML代码空格,回车换行符的函数