我節省使用下面的代碼FPDF PDF文檔的文件...FPDF輸出中()將與HTML擴展
$pdf->Output('doc.pdf','D');
...但將其保存爲「doc.pdf.html」
爲什麼要添加html擴展名?
我節省使用下面的代碼FPDF PDF文檔的文件...FPDF輸出中()將與HTML擴展
$pdf->Output('doc.pdf','D');
...但將其保存爲「doc.pdf.html」
爲什麼要添加html擴展名?
在我的情況下,這個問題的原因是在我回顯PDF之後,我沒有終止腳本。我正在使用一個框架,並讓它完成了這是造成問題。所以只需添加一個「退出」語句,它應該修復它。
謝謝@Chad我有這個問題,這解決了它 – 2017-05-11 13:03:56
它不添加 '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;
所以這個問題必須在別處。
我知道它所放入的$ name實際上以.pdf而不是.html結尾。 – Chad 2010-11-20 15:10:24
我已經縮小了問題範圍。它只發生在Safari和Chrome上。 Firefox完美運作。 – Chad 2010-11-20 15:29:49