• Stars
    star
    326
  • Rank 128,622 (Top 3 %)
  • Language
    PHP
  • Created over 9 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

一个简单好用的PHP汉字转拼音类,支持获取汉字的拼音以及拼音的缩写,能准确匹配6千多个汉字。

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');//获取拼音缩写