色综合图-色综合图片-色综合图片二区150p-色综合图区-玖玖国产精品视频-玖玖香蕉视频

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

繁體中文轉換為簡體中文的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
主站蜘蛛池模板: 亚洲欧美日韩国产综合 | 成人牲交一极毛片 | 成年男女免费视频网站 | 91av综合 | 中文精品爱久久久国产 | 久久久精品在线观看 | 成人夜色香网站在线观看 | 久草在线观看资源 | 成人a毛片| 2022日韩理论片在线观看 | www.黄色免费 | 91精品国产一区二区三区四区 | 欧美一区二区三区在线观看免费 | 国产成人一区二区三区影院免费 | 免费公开视频人人人人人人人 | 国产做a爰片久久毛片a | 久久精品午夜视频 | 欧美一区二区三区日韩免费播 | 日本成本人视频 | 亚洲乱强 | 毛片大全在线 | 玖玖色视频 | 99在线热视频只有精品免费 | 国内自拍视频在线看免费观看 | 亚洲精品国产福利一区二区三区 | 久久精品国产半推半就 | 狠狠ady精品| 国产精品亚洲精品久久成人 | 亚洲精品91香蕉综合区 | 国产a级特黄的片子视频免费 | 欧美亚洲国产成人高清在线 | 久草国产在线观看 | 免费永久国产在线视频 | 欧美视频一区二区三区四区 | 色综合91久久精品中文字幕 | 免费a级黄毛片 | 国产精品特黄一级国产大片 | 久久精品国产亚洲片 | 女人张开腿让男人插 | 男女午夜爱爱久久无遮挡 | 欧美怡红院高清在线 |