phpexcel导出excel的时候,加上下面这几行代码,设置一下header
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/vnd.ms-excel");
header("Content-Type:application/octet-stream");
header("Content-Type:application/download");;
header("Content-Disposition:attachment;filename=filename.xlsx");
header("Content-Transfer-Encoding:binary");
header("Expires: 0");
header("Cache-Control:must-revalidate, post-check=0, pre-check=0");
header("Content-Type:application/force-download");
header("Content-Type:application/vnd.ms-excel");
header("Content-Type:application/octet-stream");
header("Content-Type:application/download");;
header("Content-Disposition:attachment;filename=filename.xlsx");
header("Content-Transfer-Encoding:binary");
并且在最后save之后,记得exit终止程序
这样操作后,phpexcel在苹果手机safari浏览器上导出excel的时候就不会再带有.html后缀了。