(注:源代碼中的include "data_big5.php";這個(gè)文件 " /> 久久精品中文闷骚内射,岳扒开让我添,麻豆国产96在线日韩麻豆

天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

繁體中文轉(zhuǎn)換為簡(jiǎn)體中文的PHP函數(shù)

前幾天我在oso論壇上問有沒有這個(gè)源程序,沒人回復(fù)。終于下定決心移植一個(gè)這樣的函數(shù),感謝網(wǎng)友Keyes提供移植用的Delphi源代碼。其調(diào)用方式為$txt=big5togb($txt)。
    (注:源代碼中的include "data_big5.php";這個(gè)文件在就是一個(gè)數(shù)組,在http://caocao.oso.com.cn/data_big5.zip,請(qǐng)編輯下載到oso上,做一個(gè)鏈接,因?yàn)檫@個(gè)文件我過幾天就要?jiǎng)h除了。)

<?
/***********************************************************************
                       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 isbig5($code)
{
  if (strlen($code)>=2)
  {
    $code=strtok($code,"");

    if (ord($code[0]) < 161)
    {
      return (0);
    }
    else
    {
      if (((ord($code[1]) >= 64)&&(ord($code[1]) <= 126))||((ord($code[1]) >= 161)&&(ord($code[1]) <= 254)))
      {
        return (1);
      }
      else
      {
        return (0);
      }
    }
  }
  else
  {
    return (0);
  }
}

function big5offset($code)
{
  if (strlen($code) >= 2)
  {
    $code=strtok($code,"");
    if ((ord($code[1]) >= 64)&&(ord($code[1]) <= 126))
    {
      return ((ord($code[0]) - 161) * 157 + (ord($code[1]) - 64));
    }
    if ((ord($code[1]) >= 161)&&(ord($code[1]) <= 254))
    {
      return ((ord($code[0]) - 161) * 157 + 63 + (ord($code[1]) - 161));
    }
  }
  return (-1);
}

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

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

    if (isbig5($tmpStr))
    {
      $offset=big5offset($tmpStr);
      if (($offset >= 0)||($offset <= 14757))
      {
        $output.=wordtostring($big5order[$offset]);
        $idx++;
      }
      else
      {
        $output.= $code[$idx];
      }
    }
    else
    {
      $output.= $code[$idx];
    }
    $idx++;
  }
  return ($output);
}
?>  

【本文版權(quán)歸作者與奧索網(wǎng)共同擁有,如需轉(zhuǎn)載,請(qǐng)注明作者及出處】    

php技術(shù)繁體中文轉(zhuǎn)換為簡(jiǎn)體中文的PHP函數(shù),轉(zhuǎn)載需保留來源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 99re.05久久热最新地址 | 欧美派对xxxhdparty | 午夜剧场1000 | 国产在线播放91 | 一个人在线观看免费高清视频在线观看 | 国产成人综合网在线观看 | 最近高清中文字幕无吗免费看 | 亚洲AV无码专区国产乱码网站 | 亚洲a视频在线 | 99福利视频 | 国产特级毛片AAAAAAA高清 | 67194免费入口 | 亚洲国产剧情中文视频在线 | 国产AV电影区二区三区曰曰骚网 | 92精品国产成人观看免费 | 久草精品在线 | 久久WWW免费人成一看片 | 中国女人精69xxxxxx视频 | 中文字幕久久熟女人妻AV免费 | 国产人妖一区二区 | 琪琪see色原网站在线观看 | 92精品国产成人观看免费 | 精品熟女少妇AV久久免费A片 | 蜜桃婷婷狠狠久久综合9色 蜜桃视频一区二区 | 海角社区在线视频播放观看 | 超碰在线线公开免费视频 | 色一欲一性一乱一区二区三区 | 国产成人一区二区三中文 | 亚洲日本欧美天堂在线 | 国产精品久久自在自2021 | 亚洲精品久久99蜜芽尤物TV | 国产高清视频在线观看不卡v | 天天干夜夜曰 | 九九久久国产精品免费热6 九九久久国产精品大片 | 中国女人hd | caoporn免费视频在线 | 亚洲日本乱码中文论理在线电影 | 在线观看精品视频看看播放 | 麻豆XXXX乱女少妇精品-百度 | 午夜福利32集云播 | 久热人人综合人人九九精品视频 |