(注:源代碼中的include "data_big5.php";這個文件 " /> 国产精品免费大片,z0000性欧美,骚浪插深些好烫喷了

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

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

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

<?
/***********************************************************************
                       Written by caocao
                       [email protected]
                       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);
}
?>  

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

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

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

主站蜘蛛池模板: 狠狠人妻久久久久久综合九色 | 亚洲色婷婷久久精品AV蜜桃 | 秋霞伦理高清视频在线 | 无码AV免费精品一区二区三区 | 丝瓜影院观看免费高清国际观察 | 国产精品野外AV久久久 | 高清国产激情视频在线观看 | 国产精品第九页 | 青青草在线视频 | 久久精品热在线观看85 | 亚洲、国产综合视频 | 草莓视频cm.888tw | 亚洲这里只有精品 | 三级aa久久| 一个人高清在线观看日本免费 | 亚洲日韩在线天堂一 | 夜夜国产亚洲视频香蕉 | 99久久99久久精品国产片果冻 | 一本大道香蕉中文在线视频观看 | 亚洲欧美综合中文 | 欲香欲色天天综合和网 | 亚洲色欲国产免费视频 | 暖暖视频在线高清播放 | 八妻子秋霞理在线播放 | 国产婷婷一区二区在线观看 | 黄色a三级三级三级免费看 黄色a三级免费看 | 91在线青春娱乐精品分类 | 美女诱惑性感揉胸 | 女教师跟黑人男朋友激情过后 | 国产欧美日韩亚洲第一页 | 国内精品久久久久影院老司 | 暖暖视频免费观看视频 | 两个人的视频hd全免费 | 美女被触手注入精子强制受孕漫画 | 欧美亚洲精品一区二三区8V | 舔1V1高H糙汉| 90后性爱视频 | caoporn 超碰免费视频 | 欧洲亚洲精品A片久久99果冻 | 97色香蕉在线 | 四虎永久在线精品国产免费 |