【发布时间】:2013-02-04 02:19:18
【问题描述】:
这与我之前的问题 re (DOMPDF) 类似,不同的是我现在使用 PHPExcel 来创建 PDF。
我尝试了 file_put 方法,但它下载的是一个空的 PDF。那么我哪里出错了,还是不能这样做?
下面是我输出字段的最终代码以及我尝试过的内容
header('Content-Type: application/pdf');
header('Content-Disposition: attachment;filename="TestSheet.pdf"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF');
$objWriter->save('php://output');
$file_location = $save_Path;
file_put_contents($file_location,$objWriter);
exit;
似乎一旦保存它就会清除数据,因此是空白 PDF
谢谢
【问题讨论】: