ERROR_MESSAGE_MAIN ERROR_MESSAGE_REASON on iPad and iPhone Safari

送分小仙女□ 提交于 2020-01-07 07:16:06

问题


My website has a functionality of downloading excel sheet. I'm using PHPExcel library with Codeigniter to create the .xlsx sheet. It works fine almost everywhere but in iPad/ iPhone Safari. The following error covers the screen. Safari Error Screenshot

My code to download the file is following:

ob_end_clean();

$filename='attendance_list.xlsx';

header('Content-Type: application/vnd.ms-excel');

header('Content-Disposition: attachment;filename="'.$filename.'"');

header('Cache-Control: max-age=0');

$objWriter = PHPExcel_IOFactory::createWriter($this->excel, 'Excel2007');

$objWriter->save('php://output');

And i am calling the php function with this code via jquery and AJAX. Please provide me with the answers.


回答1:


instead of:

header('Content-Type: application/vnd.ms-excel');

use

header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');



来源:https://stackoverflow.com/questions/43089200/error-message-main-error-message-reason-on-ipad-and-iphone-safari

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!