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


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");

php header

Anim泡菜君 9 years, 9 months ago

改成


 header('Content-Type: application/octet-stream');

芙兰朵露S老师 answered 9 years, 9 months ago

Your Answer