六月婷婷综合激情-六月婷婷综合-六月婷婷在线观看-六月婷婷在线-亚洲黄色在线网站-亚洲黄色在线观看网站

明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

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

[摘要]前幾天我在oso論壇上問有沒有這個源程序,沒人回復。終于下定決心移植一個這樣的函數,感謝網友Keyes提供移植用的Delphi源代碼。其調用方式為txt=big5togb(txt)。 (注:源代碼中的include "data_big5.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
                       [email protected]
                       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);
}
?>  

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



主站蜘蛛池模板: 中文字幕亚洲一区 | 午夜成人免费视频 | 日韩 欧美 综合 在线 制服 | 天天躁夜夜躁 | 欧美午夜视频在线 | 在线观看午夜视频 | 日日夜夜免费精品 | 日韩欧美在线观看一区 | 日韩一级视频免费观看 | 青青青国产视频 | 日日摸夜夜添欧美一区 | 日韩中文字幕久久精品 | 青草青视频在线观看 | 日本一区高清 | 日本中文在线观看 | 色狠狠网 | 青青青免费高清在线观看视频在线 | 综合激情婷婷 | 亚洲一区二区观看 | 欧美性xxxx| 永久免费看的啪啪网站 | 欧美视频高清 | 四虎 在线播放 | 日本天堂在线播放 | 欧美熟色妇 | 一本久道久久综合多人 | 日韩91| 日本男女动态图 | 在线视频中文字幕 | 欧美无人区码卡二三卡四卡 | 日韩成人激情 | 一二三四在线手机观看视频 | 日韩精品欧美成人 | 亚洲免费网站在线观看 | 偷拍久久网 | 天堂福利在线 | 色狠狠狠色噜噜噜综合网 | 欧美一级纶理片免费 | 在线视频一区二区三区 | 日韩欧美极品 | 午夜久久精品 |