可能重複:
「Warning: Cannot modify header information - headers already sent by」 error
Headers already sent by PHP警告:不能更改頭informati上 - 標題已經發出已
我有一個警告,它指出:
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\projects\wesm\intranet\plugins\company_calendar\calendarpdf.php:90) in C:\xampp\htdocs\projects\wesm\intranet\plugins\company_calendar\mpdf\mpdf.php on line 7236
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\projects\wesm\intranet\plugins\company_calendar\calendarpdf.php:90) in C:\xampp\htdocs\projects\wesm\intranet\plugins\company_calendar\mpdf\mpdf.php on line 1827
mPDF error: Some data has already been output to browser, can't send PDF file
你能給我一些建議擺脫這些警告的..
下面是我的一些代碼:
<?php
include "admin/include/connect.php";
include "include/calendarFunction.php";
$function = new calendarFunction();
$cMonth = $_GET['cMonth'];
$cYear = $_GET['cYear'];
$htmldata = $function->calendarPDF($cMonth, $cYear);
$currString = $htmldata;
$stringtoDelete = '';
$newCurrString = str_replace($stringtoDelete, " ", $currString);
$html = $newCurrString ;
include("mpdf/mpdf.php");
$mpdf=new mPDF();
$mpdf->AddPage('L');
$mpdf->WriteHTML($html);
$mpdf->Output('calendar.pdf','I');
exit;
?>
請添加您的代碼爲妥善解決 – 2012-03-16 06:36:45
這個錯誤通常是當您迴應某些內容或任何不需要的換行符或空格位於文件頂部時出現。 – Ben 2012-03-16 06:39:38