PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Mickey Chan   Chinese Party   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Usage Example
Class: Chinese Party
Convert Chinese text encodings
Author: By
Last change:
Date: 17 years ago
Size: 1,045 bytes
 

Contents

Class file image Download
<?php
/**
 * Traditional Chinese <-> Simplified Chinese Example
 * 2006-05-23 20:57
 */

require('chinese_party.class.php');

$cconv =& new chinese_party();

if (isset(
$_POST['tchi2schi'])) {
   
$strContent = $cconv->utf8_tchi2schi($_POST['strContent']);
} elseif (isset(
$_POST['schi2tchi'])) {
   
$strContent = $cconv->utf8_schi2tchi($_POST['strContent']);
} else
$strContent = "";
?>
<html>
<head>
<title>繁簡轉換測試</title>
</head>
<body>
<h3>繁簡轉換測試</h3>
<form action="<?=basename(__FILE__)?>" method="post">
<div>文章內容:</div>
<textarea name="strContent" rows="6" cols="60"><?=$strContent?></textarea><br />
<input type="submit" name="tchi2schi" value="繁體轉簡體" />
<input type="submit" name="schi2tchi" value="簡體轉繁體" />
</form>
<hr />
<p><b>已知在Big5字碼裡無法正常轉換為GB2312的中文字:</b><br />咁(<?=$cconv->uniord('咁');?>);搵(<?=$cconv->uniord('搵');?>);冇(<?=$cconv->uniord('冇');?>);磡(<?=$cconv->uniord('磡');?>);輋(<?=$cconv->uniord('輋');?>);</p>
</body>
</html>