xlsx 文件不能在 IE 中下载但在 Firefox 中正常工作我的代码是
$objPHPExcel->setActiveSheetIndex(0);
// Redirect output to a client’s web browser (Excel2007)
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header("Content-Disposition: attachment;filename='Monthly-Report-$month-$year'");
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('php://output');
//$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
exit;
在 IE 中显示错误消息,因为 Internet Explorer 无法下载 xlsx.php(这是我编写代码的 php 文件) Internet Explorer 无法打开此站点