PHP中实现汉字转区位码应用源码实例解析

前端之家收集整理的这篇文章主要介绍了PHP中实现汉字转区位码应用源码实例解析前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

<div class="codetitle"><a style="CURSOR: pointer" data="12841" class="copybut" id="copybut12841" onclick="doCopy('code12841')"> 代码如下:

<div class="codebody" id="code12841">
<?PHP
global $PHP_SELF;
//echo $PHP_SELF;
$t1=$_POST['textfield1'];
$t2=$_POST['textfield2'];
$t3=$_POST['textfield3'];
$t4=$_POST['textfield4'];
// 汉字--区位码
if($t1!=""){
$t2= sprintf("%02d%02d",ord($t1[0])-160,ord($t1[1])-160);
//echo $t2;
}
// 区位码--汉字
if($t3!=""){
$t4 = chr(substr($t3,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"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;


无<a href="https://www.jb51.cc/tag/biaoti/" target="_blank" class="keywords">标题</a>文档
<style type="text/css">




<table width="528" height="146" border="1"
align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="524" height="50"><div align="center"
class="STYLE1">汉字区位码查询系统
</td>
</tr>
<tr>
<td><form id="form1" name="form1" method="post" action=
"<?=$PHP_SELF ?>">






<form id="form2" name="form2" method="post" action="<?=$PHP_SELF ?>">




</td>
</tr>
</table>


原文链接:https://www.f2er.com/php/28487.html

猜你在找的PHP相关文章