tinkphp 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
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.