mPDF错误:有些数据已经输出到浏览器,无法发送PDF文件

问题描述 投票:2回答:1

当我尝试使用mPDF时,我收到了这样的错误。 mPDF错误:有些数据已经输出到浏览器,无法发送PDF文件

这是代码:

<?php
include("mpdf60/mpdf.php");

$mpdf=new mPDF('c','A4','','' , 0 , 0 , 0 , 0 , 0 , 0); 

$mpdf->SetDisplayMode('fullpage');

$mpdf->list_indent_first_level = 0;  // 1 or 0 - whether to indent the first level of a list

$mpdf->WriteHTML(file_get_contents('invoice.html'));

$mpdf->Output();


$to      = $_POST["email"];
$subject = 'the subject';
$message = 'hello';
$headers = 'From: [email protected]' . "\r\n" .
    'Reply-To: [email protected]' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);

你有过这个问题吗?怎么解决?谢谢

php mpdf
1个回答
0
投票

尝试在ob_end_clean之前使用include("mpdf60/mpdf.php");可以解决您的问题。

© www.soinside.com 2019 - 2024. All rights reserved.