// I have excluded lines here that successfully create a spreadsheet using PHPExcel
// ...
// ...
header("Content-disposition: attachment; filename=spreadsheet.xlsx");
header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
header("Content-Transfer-Encoding: Binary");
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save($filename);
readfile($filename);
// Now create a webpage for display
include 'import.php';
exit();
然后,import.php文件应该创建一个网页。 但是,这样做不起作用 - 而是将该网页的内容添加到电子表格中。
如果我将include 'import.php';
替换为header('Location: login.php?import');
,然后尝试检查是否已设置$_GET['import']
,则也会失败。
如何在将电子表格下载到浏览器后立即转到import.php创建的页面?