时间:2021-07-01 10:21:17 帮助过:24人阅读
phpexcel如何把导出的文件 命名 他现在已导出就是一个export 我想定义自己的名字
1.保存到webserver
$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
$objWriter->save ( '文件名.xls' );
2.浏览器下载
$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
header("Pragma: public");
header("Expires: 0");
header("Cache-Control:must-revalidate,post-check=0,pre-check=0");
header("Content-Type:application/force-download");
header("Content-Type:application/vnd.ms-execl");
header("Content-Type:application/octet-stream");
header("Content-Type:application/download");
header("Content-Disposition:attachment;filename="文件名.xls");
header("Content-Transfer-Encoding:binary");
$objWriter->save("php://output");