FPDF错误将输出发送到浏览器 [英] FPDF error sending output to browser

查看:75
本文介绍了FPDF错误将输出发送到浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到此错误消息:

FPDF错误:已经输出了一些数据,无法发送PDF文件

FPDF error: Some data has already been output, can't send PDF file

当我启动以下代码时;你知道为什么吗?你能帮我吗?

when I launch the following code; do you know why? can you help me?

$i = 0;
while ($i <= $y)
{
  $namefilepdf=$x_labelname.$i.'.pdf';
  $pdf=new FPDF();
  $pdf->AddPage($x_lay,$x_dimpag);
  $pdf->SetFont('Arial');           

  if (isset($x_toprint1))
    if ($x_toprint1=='on')
        if (isset($x_progressive1))
        {
          if ($x_progressive1=='on')
          {
            $pdf->SetFontSize($x_font1);
            $pdf->Text($x_coordx1,$x_coordy1,$x_val1+$i);
          }
        }
        else
        {
            $pdf->SetFontSize($x_font1);
            $pdf->Text($x_coordx1,$x_coordy1,$x_valore1);
        }
  $pdf->Output($namefilepdf,'D');
  $i++;
}

推荐答案

要使FPDF正常工作,就不能有任何个其他输出.诸如PHP文件中其他位置的echo语句,<?php ?>标记之前或之后的任何内容(包括空格)等,都会导致该错误消息.

For FPDF to work, there can't be any other output. Things like echo statements elsewhere in your PHP file, anything (including spaces) before or after your <?php ?> tags, etc. will cause that error message.

我怀疑您的PHP文件中的其他地方,可能存在一些非FPDF输出,导致您看到该错误.

I suspect that somewhere else in your PHP file, there's probably some non-FPDF output that's causing you to see that error.

这篇关于FPDF错误将输出发送到浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆