Home >Backend Development >PHP Tutorial >最好用的PHP汉字转拼音类:Pinyin

最好用的PHP汉字转拼音类:Pinyin

WBOY
WBOYOriginal
2016-06-20 12:53:592210browse

Pinyin

最简单、最准确的PHP中文转拼音的类

支持获取拼音以及拼音的缩写即首字母

支持utf-8、gbk等编码

能准确匹配6千多个常用汉字

单个汉字,一句话,中英文混合都完美支持

例子utf-8版

include_once 'Pinyin.php';    echo Pinyin::getPinyin("早上好");//获取拼音  echo Pinyin::getShortPinyin("早上好");//获取拼音缩写  

例子gbk版

include_once 'Pinyin.php';echo Pinyin::getPinyin("早上好",'gb2312');//获取拼音echo Pinyin::getShortPinyin("早上好",'gb2312');//获取拼音缩写

项目主页:http://www.open-open.com/lib/view/home/1435299355872

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn