Home > Backend Development > PHP Tutorial > 运用PHP实现汉字转区位码应用源码实例解析_PHP

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

WBOY
Release: 2016-06-01 12:20:29
Original
950 people have browsed it

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,0,2)+160).chr(substr($t3,2,2)+160);
//echo $t4;
}
?>
 
br /> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template