header("Pragma: public"); header("Expires: 0"); header("Cache-Control:must-revalidate, post-check=0, pre-check=0") . -Type:application/force-download"); header("Content-Type:application/vnd.ms-execl"); header("Content-Type:application/octet-stream"); application/download");; header('Content-Disposition:attachment;filename='.$fileName.''); header("Content-Transfer-Encoding:binary");/ ($spreadsheet,'Xlsx'); $writer->save('php://output');
但是如果
# $writer->save('檔案名稱' );
就可以直接儲存在根目錄,但不能下載
程式碼以及錯誤訊息, 截圖發出來