ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
~~~ /** * 简体转繁体 * @param $Text */ function gbk_to_big5($Text) { global $GB_DATA; if(empty($GB_DATA)) { $filename = CODETABLEDIR.'gb-big5.table'; $fp = fopen($filename, 'rb'); $gb = fread($fp, filesize($filename)); fclose($fp); } $max = strlen($Text)-1; for($i = 0; $i < $max; $i++) { $h = ord($Text[$i]); if($h >= 0x80) { $l = ord($Text[$i+1]); if($h==161 && $l==64) { $big = ' '; } else { $p = ($h-160)*510+($l-1)*2; $big = $GB_DATA[$p].$GB_DATA[$p+1]; } $Text[$i] = $big[0]; $Text[$i+1] = $big[1]; $i++; } } return $Text; } ~~~