header - PHP导出EXCEL文件时总是自动打开,请问如何防止?
PHPz
PHPz 2017-04-10 14:57:43
0
1
409

PHP导出EXCEL文件时总是自动打开,请问如何防止?

    header("Content-Type:   application/vnd.ms-excel; charset=utf-8");
    header("Content-Disposition: attachment; filename=$outputFileName");
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Cache-Control: private", false);
    $xlsWriter->save("php://output");
PHPz
PHPz

学习是最好的投资!

reply all(1)
Ty80

改成

header('Content-Type: application/octet-stream');
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template