OpenCC 的 PHP 扩展 opencc4php

码农软件 · 软件分类 · 常用工具包 · 2019-08-13 20:43:05

软件介绍

opencc4php 是OpenCC的PHP扩展,能很智能的完成简繁体转换。

支持 PHP 版本: 5.3 - 7.1

转换效果:

你干什么不干我事 => 你幹什麼不干我事

地区词汇转换效果:我鼠标哪儿去了 => 我滑鼠哪兒去了

安装

Linux | OS X

你需要先安装1.0.1 版本以上的OpenCC,安装OpenCC:

git clone https://github.com/BYVoid/OpenCC.git --depth 1
cd OpenCC
make
sudo make install

安装opencc4php:

git clone git@github.com:NauxLiu/opencc4php.git --depth 1
cd opencc4php
phpize
./configure
make && sudo make install

如果你的OpenCC安装目录不在/usr/usr/local,可在./configure时添加--with-opencc=[DIR]指定你的OpenCC目录。

使用方法:

$od = opencc_open("s2twp.json"); //传入配置文件名
$text = opencc_convert("我鼠标哪儿去了。", $od);
echo $text;
opencc_close($od);


本文地址:https://codercto.com/soft/d/12303.html

Hello World

Hello World

Hannah Fry / W. W. Norton Company / 2018-9 / GBP 17.99

A look inside the algorithms that are shaping our lives and the dilemmas they bring with them. If you were accused of a crime, who would you rather decide your sentence—a mathematically consistent ......一起来看看 《Hello World》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具