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); }
可以根据需要对这个函数进行扩充修改。
更多PHP 清除HTML代码、空格、回车换行符的函数相关文章请关注PHP中文网!