PHP 汉字转拼音类 PHPChineseToPinyin

码农软件 · 软件分类 · 拼音转换工具包 · 2019-08-04 09:57:21

软件介绍

简介

PHP汉字转拼音类,支持多音字、简繁中文,共20902个汉字

有用到PHP汉字转拼音,网上找了一下,这个20902个汉字是微软的字库,支持多音字。

字库是在OSC找到的,他的源代码是每次动态分割字库处理,我直接处理成了静态的PHP数组代码,应该比动态处理要快一些。

我还自己写了转换方法,支持获取一段中文的全拼和拼音首字母,支持自定义拼音分割符,应该能满足大多数使用情况了。

必须在UTF-8编码的情况下使用,否则会报错。

用法

代码

ChineseToPinyin::convert('测试一下啊',' ',$allWord,$firstWord);
print_r($allWord);
print_r($firstWord);

输出结果

Array
(
    [0] => ce shi yi xia a
    [1] => ce shi yi xia e
)
Array
(
    [0] => c s y x a
    [1] => c s y x e
)

本文地址:https://codercto.com/soft/d/11612.html

Producing Masculinity

Producing Masculinity

Michele White / Routledge / 2019-3 / $39.95

Thoughtful, witty, and illuminating, in this book Michele White explores the ways normative masculinity is associated with computers and the Internet and is a commonly enacted online gender practice. ......一起来看看 《Producing Masculinity》 这本书的介绍吧!

SHA 加密
SHA 加密

SHA 加密工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

html转js在线工具
html转js在线工具

html转js在线工具