这里人多,就发到这里来啦,群主别移动啊!~~~~(>_- class big2gb

  • {
  • function chg_utfcode($str,$charset='big5')
  • {
  • if ($charset=='big5')
  • {
  • $fd = fopen(TEMPLATEPATH . "/big2gb/gb2big.map",'r');
  • $str1 = fread($fd,filesize(TEMPLATEPATH . "/big2gb/gb2big.map"));
  • }
  • else
  • {
  • $fd = fopen(TEMPLATEPATH . "/big2gb/big2gb.map",'r');
  • $str1 = fread($fd,filesize(TEMPLATEPATH . "/big2gb/big2gb.map"));
  • }
  • fclose($fd);
  • - // convert to unicode and map code
  • $chg_utf = array();
  • for ($i=0;$i0xBF && $chuni2utf($chg_utf[$uni_code]);
  • }
  • $k += $i;
  • }
  • }
  • return $outstr;
  • }
  • - // Return utf-8 character
  • function uni2utf($uni_code)
  • {
  • if ($uni_code63) // 2^6=64
  • {
  • $outstr=chr($uni_code%64+0x80).$outstr;
  • $uni_code=floor($uni_code/64);
  • $i++;
  • }
  • switch($i)
  • {
  • case 1:
  • $outstr=chr($uni_code+0xC0).$outstr;break;
  • case 2:
  • $outstr=chr($uni_code+0xE0).$outstr;break;
  • case 3:
  • $outstr=chr($uni_code+0xF0).$outstr;break;
  • case 4:
  • $outstr=chr($uni_code+0xF8).$outstr;break;
  • case 5:
  • $outstr=chr($uni_code+0xFC).$outstr;break;
  • default:
  • echo "unicode error!!";exit;
  • }
  • return $outstr;
  • }
  • }复制代码我如何调用上面的函数呢?

public function search(){
$keyword=trim($_REQUEST['id']);
//这是我调用的 有错 大家帮忙看一下 如何调用
require_once TEMPLATEPATH . "/big2gb/big2gb.php";
$keyword = $big2gb->chg_utfcode($keyword, 'gb');

$this->assign('keyword',$keyword);
$this->assign('pplist',A("Home.Vod"));
$this->assign('title',$keyword.'-的搜索结果列表'.C('site_by'));
$this->display('pp_vodsearch');

}