这是我的代码:

<?php
include ("../connections.php");
require("fpdf181/fpdf.php");
ob_end_clean();
ob_start();
if (isset($_POST["btn_1"])) {
class PDF extends FPDF{

function Header(){
  global $title;
  $w = $this->GetStringWidth($title)+6;
  $this->SetX((210-$w)/2);
  $this->Image('fpdf181/logo.png',10,6,20);
  $this->SetFont('Times','B',30);
  $this->SetLineWidth(1);
  $this->Cell($w,10,$title,0,0,'C');
  $this->Ln(20);
}
function table(){

}
function layout(){


}

function footer(){
  $this->SetY(-15);
  $this->SetFont('Arial','I',8);
  $this->Cell(0,10,'Page '.$this->PageNo(),0,0,'C');
}
}
$pdf = new PDF();
$title = "MONTHLY SALES REPORT";
$pdf->SetTitle($title);
$pdf->AddPage();
$pdf->SetFont('Arial','B',12);
$pdf->SetFillColor(180,180,255);
$pdf->SetDrawColor(50,50,100);
$pdf->Cell(10,10,"Generic Name",1,0,'',true);
$pdf->Cell(60,10,'Branded Name',1,0,'',true);
$pdf->Cell(60,10,'Unit',1,0,'',true);
$pdf->Cell(65,10,'QTY Available',1,0,'',true);
$pdf->Ln();
$view_query = mysqli_query($connections, "SELECT * FROM product");
while ($row = mysqli_fetch_assoc($view_query))
{

$db_genericname = $row["genericname"];
$db_brandedname = $row["brandedname"];
$db_unit = $row["unit"];
$db_quantityavailable = $row["quantity_available"];

$pdf->Cell(10,10,$db_genericname,1);
$pdf->Cell(60,10,$db_brandedname,1); 
$pdf->Cell(60,10,$db_unit,1); 
$pdf->Cell(65,10,$db_quantityavailable,1); 
$pdf->Ln();
}
$pdf->Output();
ob_end_flush();
}
?>

这是我得到的错误:

致命错误:未捕获异常:FPDF错误:某些数据已经输出,无法在C:\ xampp \中发送PDF文件(输出从C:\ xampp \ htdocs \ SAD \ manager \ productrecords.php:1开始) htdocs \ SAD \ manager \ fpdf181 \ fpdf.php:271堆栈跟踪:#0 C:\ xampp \ htdocs \ SAD \ manager \ fpdf181 \ fpdf.php(1052):FPDF->错误('某些数据有... . ')#1 C:\ xampp \ htdocs \ SAD \ manager \ fpdf181 \ fpdf.php(999):FPDF - > _ checkoutput()#2 C:\ xampp \ htdocs \ SAD \ manager \ productrecords.php(258) :FPDF->输出()#3 在第271行的C:\ xampp \ htdocs \ SAD \ manager \ fpdf181 \ fpdf.php中引发

我知道该怎么做了,我尝试了我最好的搜索解决方案并尝试了它们但没有好处 . 一点帮助将不胜感激:)