(注:源代碼中的include "data_gb.php";這個文件在就是一個數組,在http://caocao.oso.com.cn/data_gb.zip,請編輯下載到oso上,做一個鏈接, " /> 三级免费网站,草草影院浮力,日韩日韩

中文字幕日韩一区二区_国产一区二区av_国产毛片av_久久久久国产一区_色婷婷电影_国产一区二区精品

簡體中文轉換為繁體中文的PHP函數

感謝網友Keyes提供移植用的Delphi源代碼。其調用方式為$txt=gbtobig5($txt)。
    (注:源代碼中的include "data_gb.php";這個文件在就是一個數組,在http://caocao.oso.com.cn/data_gb.zip,請編輯下載到oso上,做一個鏈接,因為這個文件我過幾天就要刪除了。)

<?
/***********************************************************************
                       Written by caocao
                       caocao@eastday.com
                       http://caocao.oso.com.cn

                       With the help of Keyes
                       Keyes2000@263.NET
                       http://my-wjl.scu.edu.cn/~Keyes
***********************************************************************/
function isgb($code)
{
  if (strlen($code)>=2)
  {
    $code=strtok($code,"");
    if ((ord($code[0]) < 161)||(ord($code[0]) >= 247))
    {
      return (0);
    }
    else
    {
      if ((ord($code[1]) <= 161)||(ord($code[1]) >= 254))
      {
        return (0);
      }
      else
      {
        return (1);
      }
    }
  }
  else
  {
    return (1);
  }
}

function gboffset($code)
{
  if (strlen($code) >= 2)
  {
    $code=strtok($code,"");
    return ((ord($code[0]) - 161) * 94 + (ord($code[1]) - 161));
  }
  else
  {
    return(-1);
  }
}

function wordtostring($code)
{
  return (chr(hexdec(substr($code,0,2))).chr(hexdec(substr($code,2,2))));
}

function gbtobig5($code)
{
  include "data_gb.php";
  $output="";
  $length=strlen($code);
  $code=strtok($code,"");
  $idx=0;
  while ($idx < $length)
  {
    $tmpStr=$code[$idx].$code[$idx+1];

    if (isgb($tmpStr))
    {
      $offset=gboffset($tmpStr);
      if (($offset >= 0)||($offset <= 8177))
      {
        $output.=wordtostring($gborder[$offset]);
        $idx++;
      }
      else
      {
        $output.= $code[$idx];
      }
    }
    else
    {
      $output.= $code[$idx];
    }
    $idx++;
  }
  return ($output);
};
?>  

【本文版權歸作者與奧索網共同擁有,如需轉載,請注明作者及出處】    

php技術簡體中文轉換為繁體中文的PHP函數,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 免费在线观看一区二区 | 国产在线二区 | 国产伦精品一区二区三区高清 | 69av在线视频 | 国产在线精品一区 | 久久久夜色精品亚洲 | 一区二区三区四区在线免费观看 | 一级毛片免费 | 91一区二区三区 | 亚洲国产中文字幕 | 天天搞天天操 | 国产精品久久久久久久久久免费看 | 亚洲精品久久久久avwww潮水 | 播放一级毛片 | 亚洲精品国产一区 | 草久在线 | 美女亚洲一区 | 国产 日韩 欧美 制服 另类 | 天天操天天插天天干 | 欧美日韩在线视频一区 | 国产精品二区三区 | 久久久久中文字幕 | 亚洲一区二区三区福利 | 亚洲欧洲激情 | 亚洲人成人一区二区在线观看 | 精品国产一区二区三区日日嗨 | 四色永久 | 男女网站免费观看 | 黄色片视频 | 成人网av | 一区二区三区在线 | 欧 | 国产在线观看av | 婷婷在线网站 | 亚洲视频欧美视频 | 国产日产精品一区二区三区四区 | 久久99深爱久久99精品 | 高清国产午夜精品久久久久久 | 麻豆久久久久久 | 99久久99久久精品国产片果冰 | 毛片一区二区三区 | 欧美区在线|