tinkphp execl 인코딩 문제 내보내기

17665 단어
최근 프로젝트에서 execl 내보내기 테스트에 오류가 발생했습니다. 자료를 보면 다음과 같습니다.
execl 내보내기 코드 세그먼트:
    public function exportExcel($expTitle,$expCellName,$expTableData){
        $xlsTitle = iconv('utf-8', 'gb2312', $expTitle);//    
        $fileName =     _.date('Ymd');//or $xlsTitle              
        $cellNum = count($expCellName);
        $dataNum = count($expTableData);
        vendor("PHPExcel.PHPExcel");
        $objPHPExcel = new PHPExcel();
        $cellName = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','AA','AB','AC','AD','AE','AF','AG','AH','AI','AJ','AK','AL','AM','AN','AO','AP','AQ','AR','AS','AT','AU','AV','AW','AX','AY','AZ'); 
        $objPHPExcel->getActiveSheet(0)->mergeCells('A1:'.$cellName[$cellNum-1].'1');//      
        for($i=0;$i){
            $objPHPExcel->setActiveSheetIndex(0)->setCellValue($cellName[$i].'2', $expCellName[$i][1]); 
        } 
        for($i=0;$i){
          for($j=0;$j){
            $objPHPExcel->getActiveSheet(0)->setCellValue($cellName[$j].($i+3), $expTableData[$i][$expCellName[$j][0]]);
          }             
        }  
        
        header('pragma:public');
        header('Content-type:application/vnd.ms-excel;charset=utf-8;name="'.$xlsTitle.'.xls"');
        header("Content-Disposition:attachment;filename=$fileName.xls");//attachment     inline     
        $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');  
        $objWriter->save('php://output'); 
        exit;   
    }
   function execlall(){//    Excel
        parent::YanZheng('loginemails','__APP__/Index/renew');  //          
        $xlsName  = "    ";
        $xlsCell  = array(
        array('Gaojing_jifang','    '),
        array('Gaojing_panduan','  '),
        array('Gaojing_equipment','    '),
        array('Gaojing_hpdate','      '), 
        array('Gaojing_log','    '),
        array('Gaojing_fenxi','    '),
        array('Gaojing_person','   '),
        array('Gaojing_date','    '),
        );
        $Person=new PersonModel();
        $condition1[$Person->_id]=session('loginemails');            //    
        $list1=$Person->where($condition1)->find();
        $condition["Gaojing_jifang"]=$list1["Person_bumen"];
        $xlsModel = new GaojingModel();
        $condition["Gaojing_panduan"]=$_GET['daochu'];
        
        ob_clean();   //    
if($_GET['daochu']=="all"){ $tiaojian["Gaojing_jifang"]=$list1["Person_bumen"]; $xlsData = $xlsModel->order('Gaojing_date desc')->where($tiaojian)->Field('Gaojing_jifang,Gaojing_panduan,Gaojing_equipment,Gaojing_hpdate,Gaojing_log,Gaojing_fenxi,Gaojing_person,Gaojing_date')->select(); $this->exportExcel($xlsName,$xlsCell,$xlsData); } $xlsData = $xlsModel->order('Gaojing_date desc')->where($condition)->Field('Gaojing_jifang,Gaojing_panduan,Gaojing_equipment,Gaojing_hpdate,Gaojing_log,Gaojing_fenxi,Gaojing_person,Gaojing_date')->select(); $this->exportExcel($xlsName,$xlsCell,$xlsData); }
    execlall     ob_clean()      ,        ;
  ob_clean      https://coderschool.cn/1963.html

좋은 웹페이지 즐겨찾기