国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

您的位置:首頁技術文章
文章詳情頁

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

瀏覽:5日期:2024-01-01 17:01:15
前幾天我在oso論壇上問有沒有這個源程序,沒人回復。終于下定決心移植一個這樣的函數,感謝網友Keyes提供移植用的Delphi源代碼。其調用方式為$txt=big5togb($txt)。 ;;;;(注:源代碼中的include "data_big5.php";這個文件在就是一個數組,在http://caocao.oso.com.cn/data_big5.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 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
主站蜘蛛池模板: 国产精品亚洲午夜不卡 | 欧美极品第1页专区 | 成人中文字幕在线观看 | 99久久精品免费看国产一区二区三区 | 日本三级午夜 | 欧美精品videos | 国产一级aa大片毛片 | 中文国产成人精品久久一 | 欧美一级视频在线 | 国产精品国产自线在线观看 | 免费一级毛片在线播放不收费 | 99精品在线 | 欧美一级日韩一级亚洲一级 | 神马午夜-午夜片 | 深夜福利视频在线观看 | 日韩一区二区三区在线 | 美女视频在线观看黄 | 精品一区二区在线观看 | 99精品免费在线观看 | 久久免费视频在线 | 国产成人小视频 | 国产一有一级毛片视频 | 亚洲影院国产 | 久久精品二区 | 免费一级欧美大片视频在线 | 偷拍视频一区在线观看 | 国产免费一区二区在线看 | 欧美一级毛片俄罗斯 | 9lporm自拍视频在线 | 一级毛片免费观看久 | 久久亚洲国产 | 国产成人咱精品视频免费网站 | 亚洲精品久久精品h成人 | 亚洲一级成人 | 日本久久综合 | 亚洲手机视频 | 91久久免费视频 | 国产成人免费视频 | 成人午夜爽爽爽免费视频 | 亚洲国产精品成人午夜在线观看 | 欧美一区二区三区视频在线观看 |