时间:2021-07-01 10:21:17 帮助过:7人阅读
function re($content)
{
/* return preg_replace('/(
){3,}|( ){3,}/i'),'\\1',$content); */ //错误!
/* return preg_replace('/(
| ){3,}/i'),'\\1',$content); */ //错误!
return preg_replace(array('/(
){3,}/i','/( ){3,}/i'),'\\1',$content);
}
//test
$content = '1111
@@@
aaaaM
';
echo re($content);
exit();