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

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

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

瀏覽:3日期: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 ;;;;;;;[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); } ?>;;【本文版權歸作者與奧索網共同擁有,如需轉載,請注明作者及出處】;;;;
標簽: PHP
主站蜘蛛池模板: 国产欧美一区二区日本加勒比 | 日本在线视频播放 | 美女被免费视频的网站 | 加勒比一本一道在线 | 亚洲成a v人片在线观看 | 韩国一级免费视频 | 久久99久久精品国产99热 | 免费一级a毛片在线播放 | 王朝影院一区二区三区入口 | 国产美女做爰免费视频网址 | 欧美做爰孕妇群 | 国产丶欧美丶日韩丶不卡影视 | 久久手机视频 | 99热播 | 午夜日韩 | 男女国产视频 | 成人精品一区二区激情 | 全免费毛片在线播放 | 特毛片| 美女张开大腿让男人桶 | 亚洲美女视频免费 | 日韩久草 | 91在线精品亚洲一区二区 | 日韩精品一区二区三区在线观看 | 亚洲精品综合久久中文字幕 | 九九草在线观看 | 日韩在线观看视频免费 | 色综合美国色农夫网 | 日韩一级片在线观看 | 欧美久在线观看在线观看 | 久久国产成人午夜aⅴ影院 久久国产成人亚洲精品影院老金 | 成年人国产| 五月色一区二区亚洲小说 | 一级绝黄 | 国产精品免费观在线 | 91网站网站网站在线 | 精品看片 | 全免费a级毛片免费看不卡 全免费毛片在线播放 | 一区在线免费观看 | v片在线播放 | 人成18亚洲资源在线 |