摘要: \s 匹配任何空白字符,包括空格、制表符、换页符等等 $str = "i am book\n\n\n\n\nmoth"; //去除所有的 echo preg_replace("/[\s]{2,}/","",$str); //去除多余的,保留一个 echo preg_replace("/([\s]{2,})/","\\1",$str); 阅读全文
posted @ 2010-11-10 10:57 Dufe王彬 阅读(143) 评论(0) 推荐(0) 编辑