2014-12-20 30 views
2

我得到這樣的錯誤,當我嘗試使用mPDF。 MPDF錯誤:有些數據已經被輸出到瀏覽器,不能發送PDF文件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); 

你有沒有過這樣的問題嗎?如何解決它? 謝謝

+1

[TCPDF&mPDF錯誤的可能的重複:有些數據已經輸出到瀏覽器,無法發送PDF文件](http://stackoverflow.com/questions/20146967/tcpdf-mpdf-error-some-data -has-already-been-output-to-browser-cant-send-pdf) – LucasF

+0

檢查BOM!可能重複的http://stackoverflow.com/questions/20146967/tcpdf-mpdf-error-some-data-has-already-been-output-to-browser-cant-send-pdf – LucasF

+0

@LucasF我檢查了這個問題,但答案並沒有幫助我,所以我發佈了這個。 – girl

回答

0

嘗試使用ob_end_clean之前include("mpdf60/mpdf.php");可能是解決您的問題。

相關問題