|
<?php
global $php_SELF;
//echo $php_SELF;
$t1=$_POST['textfield1'];
$t2=$_POST['textfield2'];
$t3=$_POST['textfield3'];
$t4=$_POST['textfield4'];
// 漢字--區(qū)位碼
if($t1!=""){
$t2= sprintf("%02d%02d",ord($t1[0])-160,ord($t1[1])-160);
//echo $t2;
}
// 區(qū)位碼--漢字
if($t3!=""){
$t4 = chr(substr($t3,0,2)+160).chr(substr($t3,2,2)+160);
//echo $t4;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>無(wú)標(biāo)題文檔</title>
<style type="text/css">
<!--
.STYLE1 {font-size: 18px}
-->
</style>
</head>
<body>
<table width="528" height="146" border="1"
align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="524" height="50"><div align="center"
class="STYLE1">漢字區(qū)位碼查詢(xún)系統(tǒng)</div></td>
</tr>
<tr>
<td><form id="form1" name="form1" method="post" action=
"<?=$php_SELF ?>">
<label>輸入漢字
<input name="textfield1" type="text" value="<?=$t1?>" />
</label>
<label>
<input type="submit" name="Submit" value=" 轉(zhuǎn) 換 " />
</label>
<label>
<input name="textfield2" type="text" value="<?=$t2?>" />
</label>
</form>
<br />
<form id="form2" name="form2" method="post" action="<?=$php_SELF ?>">
<label>輸入?yún)^(qū)位碼
<input name="textfield3" type="text" value="<?=$t3?>" />
</label>
<input type="submit" name="Submit2" value=" 轉(zhuǎn) 換 " />
<input name="textfield4" type="text" value="<?=$t4?>" />
</form>
</td>
</tr>
</table>
</body>
</html>
php技術(shù):PHP中實(shí)現(xiàn)漢字轉(zhuǎn)區(qū)位碼應(yīng)用源碼實(shí)例解析,轉(zhuǎn)載需保留來(lái)源!
鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。