我想将我的excel文件保存到我的服务器。
文件夹位置是public_html / PHPExcel / Generated /
请参见下面的代码:
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="filename.xls"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save(str_replace(__FILE__,'public_html/PHPExcel/generated/filename.xls',__FILE__));
谢谢
希望对您有帮助。
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/octet-stream");
header("Content-Type: application/download");;
header("Content-Disposition: attachment;filename=$filename");
header("Content-Transfer-Encoding: binary ");
$filename= 'xyz.xlsx';
$objWriter->save($filename);