午夜剧场伦理_日本一道高清_国产又黄又硬_91黄色网战_女同久久另类69精品国产_妹妹的朋友在线

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

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

瀏覽:13日期: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
主站蜘蛛池模板: 亚洲欧洲国产综合 | 黄色免费网站在线观看 | 婷婷五月在线视频 | 老牛影视av一区二区在线观看 | www.av视频在线观看 | 国产在线v| www黄色 | aaa欧美| 日韩欧美在线观看视频 | 中文在线观看视频 | 午夜免费毛片 | 调教驯服丰满美艳麻麻在线视频 | 成人看片在线 | 国产日韩在线视频 | 高潮毛片无遮挡 | a免费在线 | 欧美一级片在线看 | www.日韩一区 | 久久成年视频 | 亚洲免费观看高清 | 四虎成人免费视频 | 中文字幕av网址 | 不卡视频一区二区 | 日韩色网 | 亚洲最大网站 | 午夜日韩福利 | 日韩一二三区在线观看 | 义姐是不良妈妈在线观看 | 你懂的在线免费 | 欧美日韩一区二区三区不卡 | 尤物天堂 | 免费看黄色三级三级 | 青久久 | 精品国产香蕉 | 欧美一区二区大片 | 国产婷婷色一区二区三区在线 | 国产精品爽 | 激情久久五月天 | 欧美色图在线视频 | 超碰人人草 | 欧美专区第一页 |