企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
https://github.com/overtrue/pinyin ~~~ use Overtrue\Pinyin\Pinyin; $pinyin = new Pinyin(); $pinyin->convert('带着希望去旅行,比到达终点更美好'); // ["dai", "zhe", "xi", "wang", "qu", "lv", "xing", "bi", "dao", "da", "zhong", "dian", "geng", "mei", "hao"] $pinyin->convert('带着希望去旅行,比到达终点更美好', PINYIN_UNICODE); // ["dài","zhe","xī","wàng","qù","lǚ","xíng","bǐ","dào","dá","zhōng","diǎn","gèng","měi","hǎo"] $pinyin->convert('带着希望去旅行,比到达终点更美好', PINYIN_ASCII); //["dai4","zhe","xi1","wang4","qu4","lv3","xing2","bi3","dao4","da2","zhong1","dian3","geng4","mei3","hao3"] ~~~