?php $str=iamabook\n\n\n\n\nmoth; //去除所有的空和换行符 echopreg_replace(/[\s]{2,}/,,$str).'br'; //去除多余的空和换行符,只保留一个 echopreg_replace(/([\s]{2,})/,\\1,$str); //去除多余的空或换行$text = preg_replace(/(\r\n|\n|\r|\t)/i, '',
echo preg_replace("/([\s]{2,})/","\\1",$str);
//去除多余的空格或换行 $text = preg_replace("/(\r\n|\n|\r|\t)/i", '', $text);
$lastSeveralLineContentsArr = preg_replace("/([ |\t]{0,}[\n]{1,}){2,}/","",$lastSeveralLineContentsArr);//对Html里有连续的空行或tab给正则过滤掉>