私はfpdfライブラリを使い、fpdfの公式ドキュメントに従って使用しています。fpdf:ヘッダが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();
?>
ヘッダー()をコールしたり、サンプルコードのどこにでもPDFクラスをインスタンス化したりすることはありません。 – PetrHejda