peterkahl / chinese-master
此包已被弃用且不再维护。未建议替代包。
繁体/简体中文转换;繁体/简体中文检测。
v1.0
2020-03-30 14:27 UTC
Requires
- php: >=5.3.0
README
繁体/简体中文转换;繁体/简体中文检测。
使用说明
use peterkahl\ChineseMaster\ChineseMaster; $chm=new ChineseMaster; /** * Does string include (1 or more) characters of traditional Chinese script? * */ $isTraditional=$chm->isTraditional('龙'); # false $isTraditional=$chm->isTraditional('龍'); # true $isTraditional=$chm->isTraditional('龙龍'); # true /** * Convert text in traditional script to simplified. * */ echo $chm->trad2simp('灣龍爾'); # 湾龙尔 /** * Convert text in simplified script to traditional. * CAUTION: You will encouter errors as the size of the simplified * array is maller that that of the traditional. */ echo $chm->simp2trad('湾龙尔'); # 灣龍爾