1.将下面的代码加插在 admin/function.php 中 error_reporting(7) 后
| 代码: |
function gb2big5($Text){
global $g2b;
if($g2b==1) { $Text=str_replace("gb2312","big5",$Text); $fp = fopen("gbdata/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; }
|
2.继续在function.php中查找 function dooutput($text)
| 代码: |
function dooutput($text) {
global $debug,$showqueries,$DB,$templatecache,$gzipoutput,$gziplevel;
$text=gb2big5($text); // 新增此行
|
3.将下面的代码加插在 global.php 中 error_reporting(7) 后
| 代码: |
| if(!empty($g2b)){setcookie("lan",$g2b,0,'/');}else{$g2b=$HTTP_COOKIE_VARS['lan'];} |
4.在 global.php 所在路径下新增 gbdata 的文件夹,然后把将下面地址中的文件下载后上传至 gbdata 下
http://www.memosite.cn/script/gb-big5.table
5.在模板页面中适当位置增加如下固定的连接,即可实现简繁互换的效果。
| 代码: |
<a href="?g2b=2">简体版</a>
<a href="?g2b=1">繁体版</a>
|
该方法已在本站使用。