導(dǎo)出Excel php://output 直接返回response 第一次請(qǐng)求OK, 再請(qǐng)求第二次就報(bào)錯(cuò)了
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header("Content-Disposition: attachment;filename=".$Excel['fileName'].".xlsx");
header('Cache-Control: max-age=0');//禁止緩存
$writer = new Xlsx($spreadsheet);
$writer->save('php://output');
$c = ob_get_contents();
ob_flush();
flush();
$response = response();
$response->withHeaders([
'Content-Type' => 'application/vnd.ms-excel',
'Content-Disposition' => 'attachment;filename="'.$fileName.'"',
'Cache-Control' => 'max-age=0',
])->withBody($c);
ob_clean();
return $response;
Cannot modify header information - headers already sent by (output started at E:\\GitProject\\webman-admin\\BackEnd\\app\\common\\controller\\Manage.php:199)
第二次請(qǐng)求就報(bào)錯(cuò)了
window10
webman: 1.4.3
php: 7.4