久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

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

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

瀏覽:84日期:2024-01-01 18:00:00
感謝網友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
主站蜘蛛池模板: 沈丘县| 阿城市| 郎溪县| 阜南县| 比如县| 大方县| 蒲城县| 贺州市| 安福县| 宁武县| 丁青县| 鸡西市| 亚东县| 利辛县| 安化县| 陈巴尔虎旗| 青冈县| 改则县| 嘉义县| 郑州市| 喜德县| 本溪市| 泰安市| 贞丰县| 黄平县| 托克逊县| 永吉县| 龙江县| 郓城县| 云浮市| 儋州市| 漯河市| 如东县| 仪征市| 元阳县| 孝昌县| 忻州市| 西贡区| 海丰县| 阿合奇县| 林周县|