[英]FPDF ouput() saves file with html extension
我正在使用以下代码保存带有FPDF的PDF文档......
$pdf->Output('doc.pdf','D');
...但它将其保存为'doc.pdf.html'
为什么要添加html扩展名?
在我的情况下,这个问题是我在回应PDF之后没有立即终止脚本。 我正在使用一个框架并让它完成,这导致了问题。 所以只需添加一个“退出”语句,就应该修复它。
它不会添加“.html”扩展名:
源代码:
case 'D':
//Download file
if(ob_get_length())
$this->Error('Some data has already been output, can\'t send PDF file');
header('Content-Type: application/x-download');
if(headers_sent())
$this->Error('Some data has already been output, can\'t send PDF file');
header('Content-Length: '.strlen($this->buffer));
header('Content-Disposition: attachment; filename="'.$name.'"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
ini_set('zlib.output_compression','0');
echo $this->buffer;
break;
所以问题必定在其他地方。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.