我使用FPDF庫,當我嘗試做一個PDF,我發現了以下錯誤:FPDF庫錯誤
Warning: Cannot modify header information - headers already sent by (output started at-----) FPDF error: Some data has already been output, can't send PDF file
//Send to standard output
if(ob_get_length())
$this->Error('Some data has already been output, can\'t send PDF file');
if(php_sapi_name()!='cli')
{
//We send to a browser
header('Content-Type: application/pdf');
if(headers_sent())
$this->Error('Some data has already been output, can\'t send PDF file');
header('Content-Length: '.strlen($this->buffer));
header('Content-Disposition: inline; filename="'.$name.'"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
ini_set('zlib.output_compression','0');
}
echo $this->buffer;
檢查這個職位:[頭已經發送PHP](http://stackoverflow.com/questions/8028957/headers-already-sent-by-php) – SeanWM
你的問題在'-----'。 – mario