此情形在(zài)在(zài)本機沒發現,服務器上(shàng)報錯。解決方式很簡單
PHP
x
11
11
1
ob_end_clean();//清除緩沖區,避免亂碼(增加此行即可)
2
header("Pragma: public");
3
header("Expires: 0");
4
header("Cache-Control:must-revalidate, post-check=0, pre-check=0");
5
header("Content-Type:application/force-download");
6
header("Content-Type:application/vnd.ms-execl");
7
header("Content-Type:application/octet-stream");
8
header("Content-Type:application/download");;
9
header('Content-Disposition:attachment;filename='.$file_name.'.xls');
10
header("Content-Transfer-Encoding:binary");
11
$write->save('php://output');