时间:2021-07-01 10:21:17 帮助过:34人阅读
$file_name = isset($_GET['exam_caption']) && !empty($_GET['exam_caption']) ? $_GET['exam_caption'] : time().mt_rand(1000, 9999); $outputFileName = iconv ( 'UTF-8', 'gb2312', $file_name . '.xlsx' ); 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-excel' ); header ( 'Content-Type:application/octet-stream' ); header ( 'Content-Type:application/download' ); header ( 'Content-Disposition:attachment;filename=' . $outputFileName ); header ( 'Content-Transfer-Encoding:binary' ); $objWriter->save ( 'php://output' );