<?function gb2big5($Text){
$fp = fopen("gb-big5.table", "r");
$max=strlen($Text)-1;
for($i=0;$i<$max;$i++){
$h=ord($Text[$i]);
if($h>=160){
$l=ord($Text[$i+1]);
if($h==161 && $l==64){
$gb=" ";
}else{
fseek($fp,($h-160)*510+($l-1)*2);
$gb=fread($fp,2);
}
$Text[$i]=$gb[0];
$Text[$i+1]=$gb[1]; $i++;
}
}
fclose($fp);
return $Text;
}
/**************???a·±? end******************//**************·±?????start******************/
function big52gb($Text){
$fp = fopen("big5-gb.table", "r");
$max=strlen($Text)-1;
for($i=0;$i<$max;$i++){
$h=ord($Text[$i]);
if($h>=160){
$l=ord($Text[$i+1]);
if($h==161 && $l==64){
$gb=" ";
}else{
fseek($fp,($h-160)*510+($l-1)*2);
$gb=fread($fp,2);
}
$Text[$i]=$gb[0];
$Text[$i+1]=$gb[1];
$i++;
}
}
fclose($fp);
return $Text;
}
/**************·±?????end******************/
if(isset($_POST["rrff"])){echo "<a href=a.php>back</a><br>";
echo gb2big5($_POST[a]);
if($query) echo "OK";}
else {
echo "<meta http-equiv=Content-Type content=text/html; charset=big5>";
echo "<form action=\"a.php\" method=\"post\">";
echo "<textarea name=a cols=80 rows=20></textarea>";
echo "<input type=submit name=rrff value=big5-gb>";
echo "</form>";
} ?>
网上找的一段代码
库用了phpwind里面的库
$fp = fopen("gb-big5.table", "r");
$max=strlen($Text)-1;
for($i=0;$i<$max;$i++){
$h=ord($Text[$i]);
if($h>=160){
$l=ord($Text[$i+1]);
if($h==161 && $l==64){
$gb=" ";
}else{
fseek($fp,($h-160)*510+($l-1)*2);
$gb=fread($fp,2);
}
$Text[$i]=$gb[0];
$Text[$i+1]=$gb[1]; $i++;
}
}
fclose($fp);
return $Text;
}
/**************???a·±? end******************//**************·±?????start******************/
function big52gb($Text){
$fp = fopen("big5-gb.table", "r");
$max=strlen($Text)-1;
for($i=0;$i<$max;$i++){
$h=ord($Text[$i]);
if($h>=160){
$l=ord($Text[$i+1]);
if($h==161 && $l==64){
$gb=" ";
}else{
fseek($fp,($h-160)*510+($l-1)*2);
$gb=fread($fp,2);
}
$Text[$i]=$gb[0];
$Text[$i+1]=$gb[1];
$i++;
}
}
fclose($fp);
return $Text;
}
/**************·±?????end******************/
if(isset($_POST["rrff"])){echo "<a href=a.php>back</a><br>";
echo gb2big5($_POST[a]);
if($query) echo "OK";}
else {
echo "<meta http-equiv=Content-Type content=text/html; charset=big5>";
echo "<form action=\"a.php\" method=\"post\">";
echo "<textarea name=a cols=80 rows=20></textarea>";
echo "<input type=submit name=rrff value=big5-gb>";
echo "</form>";
} ?>
网上找的一段代码
库用了phpwind里面的库
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货