Level 58
It looks like you are missing the ob_end_clean() function before the headers. This function will clear the output buffer and prevent any errors from being outputted.
Try adding the following code before the headers:
ob_end_clean();
Summer Sale! All accounts are 50% off this week.
i'm trying to force download excel sheet instead of saving it to the public directory, but it returns this.
General Error.
General Input/output error.
this is the code i'm using
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->setCellValue('A1', 'first_name');
$sheet->setCellValue('B1', 'last_name');
$sheet->setCellValue('C1', 'gender');
$sheet->setCellValue('D1', 'dial_code');
$sheet->setCellValue('E1', 'phone');
$sheet->setCellValue('F1', 'email');
$writer = new Xlsx($spreadsheet);
header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
header("Content-Disposition: attachment;filename=\"parents_data.xlsx\"");
header("Cache-Control: max-age=0");
header("Expires: Fri, 11 Nov 2011 11:11:11 GMT");
header("Last-Modified: ". gmdate("D, d M Y H:i:s") ." GMT");
header("Cache-Control: cache, must-revalidate");
header("Pragma: public");
$writer->save("php://output");
Please or to participate in this conversation.