有用代码 清除不可见空格 blueidea2020年3月27日Post a Comment 用 $str = preg_replace('/^[\pZ\pC]+|[\pZ\pC]+$/u','',$str); http://php.net/manual/zh/regexp.reference.unicode.php 在选用 UTF-8模式时用于匹配通用字符类型 pC:所有的unicode“other”pZ:所有的unicode“separator” ,所有空格和不可见字符