国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

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

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

瀏覽:67日期: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
主站蜘蛛池模板: 芒康县| 宁波市| 宝坻区| 大城县| 双牌县| 牟定县| 蓬莱市| 钦州市| 水富县| 盐边县| 宝兴县| 凌云县| 上高县| 榆社县| 留坝县| 上林县| 天长市| 黑水县| 肇州县| 乐昌市| 藁城市| 日土县| 高阳县| 红安县| 临泽县| 嘉峪关市| 柳林县| 东宁县| 平利县| 安仁县| 龙门县| 望城县| 九台市| 宁波市| 报价| 武陟县| 达孜县| 朝阳区| 商都县| 绥化市| 京山县|