我正在使用 mPDF 从 PHP 生成的站点动态创建 PDF。
我的代码如下所示:
ini_set('memory_limit', '-1');
include('../mpdf/mpdf.php');
$numPresup = "presupuesto_".$_GET['numPresup'].".html";
echo $numPresup;
$mpdf=new mPDF();
$stylesheet = file_get_contents('design.css');
$mpdf->WriteHTML($stylesheet,1);
$mpdf->WriteHTML(file_get_contents($numPresup));
$mpdf->Output();
unlink($numPresup);
exit;
但我不断收到此错误:
Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhost/artidental.com/home/html/Presupuestos/pdfExport.php:5) in /var/www/vhost/artidental.com/home/html/mpdf/mpdf.php on line 7049
Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhost/artidental.com/home/html/Presupuestos/pdfExport.php:5) in /var/www/vhost/artidental.com/home/html/mpdf/mpdf.php on line 1727
mPDF error: Some data has already been output to browser, can't send PDF file
任何线索可能是什么问题?PDF 文件工作正常,因为我用“Hello World”测试了 PDF 并且它工作正常。
谢谢