$str =' Controllable Eu valence for photoluminescence tuning in apatite-typed';
在编码为GBK的情况下是'聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽Controllable Eu valence for photoluminescence tuning in apatite-typed';
在utf-8下是' Controllable Eu valence for photoluminescence tuning in apatite-typed';
如何去除空格?
用
$str = preg_replace('/^[\pZ\pC]+|[\pZ\pC]+$/u','',$str);
http://php.net/manual/zh/regexp.reference.unicode.php
pC:所有的unicode“other”
pZ:所有的unicode“separator” ,所有空格和不可见字符