|
@@ -37,7 +37,6 @@ function array_get($array, $key, $default = null)
|
|
|
* @param array $textValue ['a']
|
|
|
*/
|
|
|
function export_exl($expTitle, $expCellName, $expTableData, $textValue=[]) {
|
|
|
- $xlsTitle = iconv('utf-8', 'gb2312', $expTitle); //文件名称
|
|
|
$fileName = $expTitle . date('_YmdHis'); //or $xlsTitle 文件名称可根据自己情况设定
|
|
|
$cellNum = count($expCellName);
|
|
|
$dataNum = count($expTableData);
|
|
@@ -56,10 +55,11 @@ function export_exl($expTitle, $expCellName, $expTableData, $textValue=[]) {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ ob_end_clean();
|
|
|
header('pragma:public');
|
|
|
- header('Content-type:application/vnd.ms-excel;charset=utf-8;name="' . $xlsTitle . '.xls"');
|
|
|
+ header('Content-type:application/vnd.ms-excel');
|
|
|
header("Content-Disposition:attachment;filename=$fileName.xls"); //attachment新窗口打印inline本窗口打印
|
|
|
- $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
|
|
+ $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
|
|
$objWriter->save('php://output');
|
|
|
exit;
|
|
|
}
|