簡體   English   中英

FPDF 導出.html 而不是.pdf,僅在 Mac 上

[英]FPDF exports .html instead of .pdf, only on Mac

我正在使用 PHP 庫 FPDF 在我的網站上生成 PDF。 它適用於除 Mac 以外的所有設備。 它保存一個 .html 文件而不是 .pdf。 即使是 iPhone 也能完美運行。 這是我的代碼:

<?php
        
require('includes/fpdf/fpdf.php');

class PDF extends FPDF {}
$mypdf = new FPDF();

// Content of PDF begins
// [...]
// Content of PDF ends

$file = utf8_decode('test.pdf');
$mypdf->Output('F', 'includes/exports/'.$file);
header('Content-Type: application/pdf');
header("Content-Disposition: attachment; filename=\"". basename($file) ."\""); 
readfile('includes/exports/'.$file);
exit(); ?>
        

謝謝您的幫助!

實現它的唯一方法是存儲 PDF 並向用戶顯示下載鏈接。 好的解決方法

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM