字符编码相关编程

去掉bom头

 function removeBom($string)
    {
        if(substr($string, 0, 3) == pack("CCC", 0xef, 0xbb, 0xbf)) {
              return substr($string, 3);
        }
        return $string;
    }

汉字转拼音类

git码云链接

Last updated