【求助】求一段gb转big5的php代码 我用过一些,并不怎么好用!而且效率不高!还是来个独立服务器,用应用程序转换的好! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我只要个函数把从数据库的取出来的字符串转换一下就行啦因为数据库里的东西是简体的而网页的是繁体的 呵呵,刚好我从ChinaUnix.net上看到一个程序,呵呵,也许对你有用:URL: http://www.chinaunix.net/jh/27/16006.html####################################################################<font size=4><b>Make your GB file to Big5 file</b></font> <font size=2>Powered by zyme. Welcome to www.ipisu.com.</font><br><br><form action='<?$php_self;?>' method=post>The GB file:<input name='srcfile'><input type=submit value='Make!'></form><?php //Powered by zyme //Welcome to www.ipisu.comif($srcfile!=""{/////////////////----------------$mb_file="hc.tab";$d_big5_er="^";$gb_file=$srcfile;$big5_file=time()."big5_file";//----------------if(!fopen($gb_file,"r"){echo"<br><br><font color=red size=4>The $gb_file file is not ready!</font>";exit;}if(!fopen($mb_file,"r"){echo"<br><br><font color=red size=4>The $mb_file file is not ready!</font>";exit;}$mb_fl=file($mb_file);$gb_fl=file($gb_file);for($a=0;$gb_fl[$a];$a++){$gb_l_len=strlen($gb_fl[$a]);for($b=0;$b<=$gb_l_len;$b++){$o_w=substr($gb_fl[$a],$b,1);if(ord($o_w)>12{$o_w=substr($gb_fl[$a],$b,2);for($c=0;$mb_fl[$c];$c++){if($o_w==substr($mb_fl[$c],0,2)){$n_w=substr($mb_fl[$c],2,-1);if(strlen($n_w)>2){$n_w=$d_big5_er.$n_w.$d_big5_er;}break;}else if(!$mb_fl[$c+1]){$n_w=$o_w;}}$b++;}else{$n_w=$o_w;}$big5_fl[$a]=$big5_fl[$a].$n_w;}$big5_src=$big5_src.$big5_fl[$a];}//--------------$fp=fopen($big5_file,"w+";fwrite($fp,$big5_src);//--------------echo"<br><br>Complete! <a href=$big5_file>Visit the big5 file now!</a>";////////////////}?>############################################################################# 谢谢楼上的兄弟虽然没用的程序但是方法是类似的 请问一个全局变量的问题。 php 新手,在安装时遇到奇怪的问题,忘指教 麻烦介绍一下开发一个PHP网站需要用到的知识 这条SQL语句有没问题 如何组装一个模版? php生成Excel问题。 mysql_fetch_array(): 出错问题 关于新窗口控制父窗口的问题,opener找不到 大伙看看这段代码!是什么意思?高手请进! 在线! 关于apache的问题。 请问这条mysql查询语句错在哪里? 简单问题,马上给分,入门问题!!在线
把从数据库的取出来的字符串转换一下就行啦
因为数据库里的东西是简体的而网页的是繁体的
URL: http://www.chinaunix.net/jh/27/16006.html####################################################################
<font size=4><b>Make your GB file to Big5 file</b></font>
<font size=2>Powered by zyme. Welcome to www.ipisu.com.</font><br><br>
<form action='<?$php_self;?>' method=post>
The GB file:<input name='srcfile'>
<input type=submit value='Make!'>
</form>
<?php //Powered by zyme //Welcome to www.ipisu.com
if($srcfile!=""
{
///////////////
//----------------
$mb_file="hc.tab";
$d_big5_er="^";
$gb_file=$srcfile;
$big5_file=time()."big5_file";
//----------------
if(!fopen($gb_file,"r"){echo"<br><br><font color=red size=4>The $gb_file file is not ready!</font>";exit;}
if(!fopen($mb_file,"r"){echo"<br><br><font color=red size=4>The $mb_file file is not ready!</font>";exit;}
$mb_fl=file($mb_file);
$gb_fl=file($gb_file);for($a=0;$gb_fl[$a];$a++)
{
$gb_l_len=strlen($gb_fl[$a]);
for($b=0;$b<=$gb_l_len;$b++)
{
$o_w=substr($gb_fl[$a],$b,1);
if(ord($o_w)>12
{
$o_w=substr($gb_fl[$a],$b,2);
for($c=0;$mb_fl[$c];$c++)
{
if($o_w==substr($mb_fl[$c],0,2))
{
$n_w=substr($mb_fl[$c],2,-1);
if(strlen($n_w)>2)
{
$n_w=$d_big5_er.$n_w.$d_big5_er;
}
break;
}
else if(!$mb_fl[$c+1])
{
$n_w=$o_w;
}
}
$b++;
}
else
{
$n_w=$o_w;
}
$big5_fl[$a]=$big5_fl[$a].$n_w;
}
$big5_src=$big5_src.$big5_fl[$a];
}
//--------------
$fp=fopen($big5_file,"w+";
fwrite($fp,$big5_src);
//--------------
echo"<br><br>Complete! <a href=$big5_file>Visit the big5 file now!</a>";
////////////////
}
?>
#############################################################################
虽然没用的程序
但是方法是类似的