【发布时间】:2017-09-28 21:58:03
【问题描述】:
这是我的代码
<body>
<section id="container" >
<?php require 'inc/header.php';?>
<section id="main-content">
<section class="wrapper">
<div class="row">
<div class="row mt">
<div class="col-md-12">
<div class="content-panel">
<!-- 1ere ETAPE -->
<h1 style="text-align:center ;"> Rénitialisation </h1>
<div class="etape1">
<?php
require('inc/reni/fpdf.php');
$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',10);
$pdf->Ln();
$pdf->Ln();
$pdf->SetFont('times','B',10);
$pdf->Cell(25,7,"nom");
$pdf->Cell(30,7,"prenom");
$pdf->Ln();
$pdf->Cell(450,7,"----------------------------------------------------------------------------------------------------------------------------------------------------------------------");
$pdf->Ln();
include ('inc/reni/db.php');
$sql="SELECT * FROM table1";
$result = $bdd->query($sql);
while($rows=$result->fetch())
{
$nom = $rows[0];
$prenom = $rows[1];
$pdf->Cell(25,7,$nom);
$pdf->Cell(30,7,$prenom);
$pdf->Ln();
}
$pdf->Output();?>
</div>
</div>
</div>
</div><!-- /col-md-12 -->
</div><!-- /row -->
</section><! --/wrapper -->
</section><!-- /MAIN CONTENT -->
</section>
<?php require 'inc/script.php';?>
</body>
错误是:致命错误:未捕获异常:FPDF错误:一些数据已经输出,无法发送PDF文件。 我尝试了一切,比如 add ob_end_clean(); ob_start ();ob_end_flush(); 当我这样做时,我的页面是空的,Pdf 不显示
【问题讨论】:
-
请在此处添加您的代码而不是图片。您需要在向您的页面发送任何其他内容之前输出 PDF。
-
我只是编辑我的帖子