> For the complete documentation index, see [llms.txt](https://phper.shujuwajue.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://phper.shujuwajue.com/ji-chu/zi-fu-chuan/zi-fu-bian-ma-xiang-guan-bian-cheng.md).

# 字符编码相关编程

**去掉bom头**

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

**汉字转拼音类**

[git码云链接](http://git.oschina.net/revinbian/PHPTools/blob/master/代码整理/PHP类/Pinyin.class.php)
