PHP HTML Excel导出不起作用

时间:2016-08-09 13:21:33

标签: php html excel export

PHP HTML Excel导出无法正常工作,导出的Excel文件在MS Excel 2016版本中打开时显示为空白。在使用MS EXCEL 2013及更低版本打开文件时工作正常。用于将html转换为.Xls的cod是

<?php
    header("Pragma: public");
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Content-Type: application/force-download");
    header("Content-Type: application/octet-stream");
    header("Content-Type: application/download");
    header("Content-Disposition: attachment;filename=export.xls");
    header("Content-Transfer-Encoding: binary ");
?>
<table>
    <tr>
        <td>Hello</td>
   </tr>
</table>

1 个答案:

答案 0 :(得分:1)

在Windows资源管理器中右键单击下载的文件,然后单击“属性”,然后选中“解锁”复选框。然后该文件将像以前一样打开。到目前为止,我找不到更好的解决方案。