From 98c4f50127b7b7e50c4d9dca1118d6d05daedd15 Mon Sep 17 00:00:00 2001 From: "IA2301\\IA_2301" Date: Tue, 12 Mar 2024 10:28:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20Ctranslate=20class=20?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E7=B0=A1=E7=B9=81=E9=AB=94=E4=BA=92=E8=BD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wms/class/Ctranslate.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 wms/class/Ctranslate.php diff --git a/wms/class/Ctranslate.php b/wms/class/Ctranslate.php new file mode 100644 index 00000000..dbbbaa0e --- /dev/null +++ b/wms/class/Ctranslate.php @@ -0,0 +1,25 @@ +convert($str,true); + } + + function tradToSimple($str){ + return $this->convert($str,false); + } +} +// $str = '平時已秉班揚筆,暇處不妨甘石經。吾里忻傳日邊信,君言頻中斗杓星。會稽夫子餘詩禮,巴蜀君平舊典型。歷歷周天三百度,更參璿玉到虞廷。'; +// echo HanziConvert::convert($str);//默认是繁体转简体 +// echo HanziConvert::convert($str,true);//第二个参数传入布尔真则是简体转繁体 + + +//简体转繁体 +echo $str = '平时已秉班扬笔,暇处不妨甘石经。吾里忻传日边信,君言频中斗杓星。会稽夫子余诗礼,巴蜀君平旧典型。歷歷周天三百度,更参璇玉到虞廷。'; +echo "
"; + +$ct = new Ctranslate(); +echo $ct->simpleToTrad($str); \ No newline at end of file