我正在使用FPDF库,当我试图创建PDF时,我得到了以下错误:
警告:无法修改标题信息-已由(输出开始于--) FPDF错误:一些数据已经输出,不能发送PDF文件
//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;发布于 2013-04-13 13:01:38
在某种程度上,某些东西会导致php向客户端发送数据。
如果找不到任何原因(即没有显式发送数据),那么在源文件中的PHP代码(<?php)开始之前,查找偏离的文本、空格、换行符等。
这应该能解决这个问题。
注意:正如wh1t3h4ck5指出的,如果错误源不在当前文件中,则还必须检查所包含的文件。查找最近修改的文件。
https://stackoverflow.com/questions/15988042
复制相似问题