PHP code example of tiacx / chinese-converter

1. Go to this page and download the library: Download tiacx/chinese-converter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tiacx / chinese-converter example snippets


use Tiacx\ChineseConverter;

// 简体转标准繁体
echo ChineseConverter::convert('心里', 's2t'), "\n";
// 简体转台湾繁体
echo ChineseConverter::convert('心里', 's2tw'), "\n";
// 简体转香港繁体
echo ChineseConverter::convert('心里', 's2hk'), "\n";
// 标准繁体转简体
echo ChineseConverter::convert('心裏', 't2s'), "\n";
// 台湾繁体转简体
echo ChineseConverter::convert('心裡', 'tw2s'), "\n";
// 香港繁体转简体
echo ChineseConverter::convert('心裏', 'hk2s'), "\n";

use Tiacx\ChineseConverter;

print_r(ChineseConverter::convertGetAll('心里'));
print_r(ChineseConverter::convertGetAll('心裡'));
print_r(ChineseConverter::convertGetAll('心裏'));