1
在這裏工作是我的代碼:功能在FPDF細胞
<?php
define('FPDF_FONTPATH','../../fpdf/font/');
require('../../fpdf/fpdf.php');
$pdf = new FPDF('L','mm','A4');
$pdf->Open();
$pdf->AddPage();
function codes($total,$mark){
$perc = $mark/$total*100;
if($perc >= 94){echo "A1";}
if($perc >= 84 && $perc<= 93){echo "A2";}
if($perc >= 72 && $perc<= 83){echo "B1";}
if($perc >= 60 && $perc<= 71){echo "B2";}
if($perc >= 49 && $perc<= 59){echo "C1";}
if($perc >= 40 && $perc<= 48){echo "C2";}
if($perc >=0 && $perc<= 40){echo "D";}
}
$pdf->SetFont('Arial','',10);
$pdf->Ln();
$pdf->Cell(30,8,'English',1,0,'L',0,'');
$pdf->Cell(15,8,codes(25,$fa1enga),1,0,'C',0,'');
$pdf->output();
但是當我運行這個PHP代碼,它打印:
B2FPDF error: Some data has already been output, can't send PDF file
請幫我顯示文本「B2」或無論在fpdf單元格中。
我相信錯誤在於你包含的文件使用require ... – 2016-11-23 19:58:26