我已經使用了fpdf庫並根據fpdf的官方文檔使用它。fpdf:header不能在fpdf中工作
我想在我的文件中使用標題,但無法使用它,下面是我的代碼相同。請糾正我的錯誤,爲什麼標題不來..
這裏是我的代碼:
<?php
require('fpdf/fpdf.php');
class PDF extends FPDF
{
function Header()
{
// Select Arial bold 15
$this->SetFont('Arial','B',5);
// Move to the right
$this->Cell(80,'ddd');
// Framed title
$this->Cell(30,10,'Title',1,0,'C');
$this->Cell(20,10,'Title',1,1,'C');
// Line break
$this->Ln(20);
}
}
$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('Times','B',14);
$pdf->Cell(20,10,'Title',1,1,'C');
$pdf->Output();
?>
您不是在示例代碼中的任何位置調用Header()或實例化PDF類。 – PetrHejda