PHP汉字转拼音类

WBOY
Release: 2016-06-23 13:31:35
Original
1016 people have browsed it

最简单、最准确的PHP中文转拼音的类 github项目地址:https://github.com/jifei/Pinyin

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

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!