鍍金池/ 問答/PHP/ 使用safari瀏覽器導出Excel文件后綴會加一個.html

使用safari瀏覽器導出Excel文件后綴會加一個.html

導出的文件后綴多了一個.html
刪除.html然后文件是可以正常的打開,有沒有大佬遇到這種問題或者解決過這種問題啊、

回答
編輯回答
愚念

導出代碼最后加一個exit即可。

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.'.xls"');
header("Content-Transfer-Encoding:binary");
$objWriter->save('php://output');
exit;

2017年8月14日 16:29
編輯回答
傻叼

服務器配置的問題吧,Excel的路徑也匹配到了偽靜態(tài)的規(guī)則

2018年2月21日 10:38
編輯回答
貓小柒

這個,我遇到過中文有亂碼的,這個.html肯定你是輸出文件名的時候加的吧

2017年7月13日 08:58