去除内容中所有的多余的空格和空行
php > $str = "a b c d\n\ne f g \t 2";
php > echo preg_replace('/\s+/',' ',$str);
a b c d e f g 2
php > echo $str;
a b c d
e f g 2
php > echo preg_replace('/(\s)+/','$1',$str);
a b c d
e f g 2
应该没有写错
膘叔的简单人生

去除内容中所有的多余的空格和空行
php > $str = "a b c d\n\ne f g \t 2";
php > echo preg_replace('/\s+/',' ',$str);
a b c d e f g 2
php > echo $str;
a b c d
e f g 2
php > echo preg_replace('/(\s)+/','$1',$str);
a b c d
e f g 2
评论 (0)
暂无评论