PHP去除多余空格 多个连续空格只保留一个

2015-01-08 0 521
PHP去除多余空格 多个连续空格只保留一个
/**
* 多个连续空格只保留一个
*
* @param string $string 待转换的字符串
* @return unknown
*/
static public function merge_spaces ( $string )
{
    return preg_replace ( "/\s(?=\s)/","\\1", $string );
}

遇见资源网 php PHP去除多余空格 多个连续空格只保留一个 http://www.ox520.com/7188.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务