php
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.
instead of:
header('Content-Type: application/vnd.ms-excel');
use
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
链接地址: http://www.djcxy.com/p/46886.html上一篇: 如何在safari中下载base64内容
下一篇: PHP