Home  >  Article  >  Backend Development  >  PHP Chinese simplified and traditional conversion code perfectly supports mainland China, Hong Kong, Taiwan and Singapore_PHP tutorial

PHP Chinese simplified and traditional conversion code perfectly supports mainland China, Hong Kong, Taiwan and Singapore_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:39:491050browse

Example: (Simplified> Traditional)Bread> Bread(zh-tw)Laos> Laos(zh-hk)China Life> China Life(zh-hk)Ronaldo> Ronaldo(zh-hk)( Traditional > Simplified) Memory > Memory (zh-cn) Bush > Bush (zh-cn) Database > Database (zh-cn) usage
1. Download MediaWiki: (http:// www.jb51.net/codes/25190.html), decompress in the path such as: /var/lib/mediawiki-1.13.3

2. Download mediawiki-zhconverter (the above file has been integrated), decompress And copy mediawiki-zhconverter.inc.php to your PHP program

3. Set the MediaWiki path in your program, and reference mediawiki-zhconverter

define("MEDIAWIKI_PATH", " /var/lib/mediawiki-1.14.0/");require_once "mediawiki-zhconverter.inc.php";4. Make the conversion

/* MediaWikiZhConverter::convert( "Word", "Conversion target "); The optional values ​​for the conversion target are zh, zh-cn, zh-tw, zh-sg, zh-hk*/echo MediaWikiZhConverter::convert("bread", "zh-tw");echo MediaWikiZhConverter::convert ("memory", "zh-cn");echo MediaWikiZhConverter::convert("Ronaldo", "zh-hk");5. Complete

Supported versions
The following MediaWiki versions have been confirmed to work Compatible with this program (http://download.wikimedia.org/mediawiki):

PHP4: 1.6.10, 1.6.11
PHP5: 1.12.0, 1.13.3
If not necessary , please use PHP5 version.

Package download address http://xiazai.jb51.nethttp://www.jb51.net/codes/25190.html

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/321514.htmlTechArticleExample: (Simplified and Traditional) Bread Bread (zh-tw) Laos (zh-hk) China Life Insurance China Life Insurance (zh-hk) Ronaldo Ronaldo (zh-hk) (Traditional and Simplified) Memory Memory (zh-cn) Bush Bush (zh-cn) Information...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn