【发布时间】:2016-02-01 10:15:59
【问题描述】:
我正在使用带有 codeignitor 的 phpexcel。以下代码仅要求下载。我希望它也应该将文件保存在以下路径中
$filename="kp.xlsx"; $filePath = FCPATH."files/application_download/".$filename;
if (file_exists($filePath)) {
unlink($filePath);
}
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');
如果我这样做 $objWriter->save($filePath);那么这将保存一个空白文件
【问题讨论】: