찾다

 >  Q&A  >  본문

header - 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");
PHPzPHPz2836일 전410

모든 응답(1)나는 대답할 것이다

  • PHP中文网

    PHP中文网2017-04-10 14:59:43

    改成

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

    회신하다
    0
  • 취소회신하다