IE中的PHPExcel将文件下载为.partial

时间:2014-03-12 16:27:06

标签: php apache phpexcel

我正在使用PHPExcel向用户编写和下载Excel文件。这在Firefox和Chrome中运行良好但在IE中失败。

这是相关代码:

    $objWriter = PHPExcel_IOFactory::createWriter($xls, 'Excel2007');
    header_remove();

    header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
    header('Content-Disposition: attachment;filename="01simple.xlsx"');
    header('Cache-Control: max-age=1');
    header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
    header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified
    header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1
    header ('Pragma: '); // HTTP/1.0
    $objWriter->save('php://output');
    exit;

但是这会导致弹出一个对话框(打开,另存为,取消)。如果我选择“打开”,则会显示错误could not open http://path_to_api。如果我点击“另存为”,则下载为“0(5).s5osyo0.partial”

任何人都有任何关于为什么会这样做的建议?

0 个答案:

没有答案