\pinyin

PHP 汉字转拼音

Examples

echo pinyin::encode('乐云网络'); //编码为拼音首字母 echo pinyin::encode('乐云网络', 'all'); //编码为全拼音


                                                                
                    

Summary

Methods
Properties
Constants
encode()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
zh2py()
$_aMaps
N/A

Properties

$_aMaps

$_aMaps : array

拼音字符转换图

Type

array

Methods

encode()

encode(string  $utf8Data, string  $sRetFormat = 'head') : string

将中文编码成拼音

Parameters

string $utf8Data

utf8字符集数据

string $sRetFormat

返回格式 [head:首字母|all:全拼音]

Returns

string —

zh2py()

zh2py(\number  $iWORD) : string

中文转换到拼音(每次处理一个字符)

Parameters

\number $iWORD

待处理字符双字节

Returns

string —

拼音