no-image

PHP:中文轉拼音和拼音轉中文

                                    

1.中文轉拼音

優點:基於開源詞庫CC-CEDICT;可返回音調;多種記憶體資源選項;支援姓名優化(多音字)

https://github.com/overtrue/pinyin

2.拼音轉中文

優點:基於baidu輸入法

API:

http://olime.baidu.com/py?input=wenghua&inputtype=py&bg=0&ed=20&result=hanzi&resultcoding=utf-8&ch_en=0&clientinfo=web&version=1

引數舉例:

{input:””,inputtype:”py”,bg:0,ed:20,result:”hanzi”,resultcoding:”unicode”,ch_en:0,clientinfo:”web”,version:1}

更多說明:

https://www.jerryzone.cn/api-pinyin-hans/

 


(adsbygoogle = window.adsbygoogle || []).push({});

function googleAdJSAtOnload() {
var element = document.createElement(“script”);
element.src = “//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”;
element.async = true;
document.body.appendChild(element);
}
if (window.addEventListener) {
window.addEventListener(“load”, googleAdJSAtOnload, false);
} else if (window.attachEvent) {
window.attachEvent(“onload”, googleAdJSAtOnload);
} else {
window.onload = googleAdJSAtOnload;
}