Php Chinese character to pinyin. Php functions for converting Chinese characters to pinyin (modified by the SpGetPinyin function of dedecms (dedecms1_deincinc_fun_funadmin.php). The Dictionary of dedecms is incomplete ):? Phpfunctionpinyin ($ str, $ is php conversion of Chinese characters to pinyin
Php functions (modified by the SpGetPinyin function of dedecms (dedecms/include/inc/inc_fun_funAdmin.php). The Dictionary of dedecms is incomplete ):
0x80) {$ c = $ str [$ I]. $ str [$ I + 1]; $ I ++; if (isset ($ pinyins [$ c]) {$ restr. = ($ ishead = 0 )? $ Pinyins [$ c]: $ pinyins [$ c] [0];} else {$ restr. = "_" ;}} else if (preg_match ("/[a-z0-9]/I", $ str [$ I]) {$ restr. = $ str [$ I];} else {$ restr. = "_" ;}}return $ restr;} // Test echo pinyin ('su insulation film ', 1 ),'
'; Echo pinyin ('Shu Xiaojia thermal insulation film', 0 ),'
'; Echo pinyin ('parrot', 1 ),'
'; Echo pinyin ('parrot', 0 ),'
'; Echo pinyin ),'
'; Echo pinyin ('Sleeping Fort/inoviswon/myside mattress', 0 ),'
';/* Result: srjgrm shurejiageremo yw yingwu mzb_ynws_mysidecd mianzhibao_yinuoweishen_mysidechuangdian */?>
See the attachment for the contained dictionaries: pinyin.rar/pinyin. dic (gbk)
: Http://files.cnblogs.com/luoyunshu/pinyin.rar
Refer:
Http://www.oschina.net/code/snippet_862384_25415
Modify the dedecms Dictionary by using the SpGetPinyin function of dedecms (dedecms/include/inc/inc_fun_funAdmin.php ):? Php function pinyin ($ str, $ is...