我正在擴展FPDF並希望包含一些外部變量,但它不起作用。我究竟做錯了什麼?擴展PHP類不接受變量
<?php
class PDF extends FPDF {
public var $DocNum;
public var $cliente;
public var $noCliente;
public var $noTienda;
public var $noPedido;
function Header() {
$this->Image('fpdf/cabMCR.jpg',5,10,100,0,'JPG','');
$this->SetFont('Arial','B','16');
$this->SetXY(125,15);
$this->Write(5,'FACTURA');
// doing some more stuff here
}
function Footer() {
$this->SetTextColor(150,150,150);
$this->SetXY(10,285);
$this->SetFont('Helvetica','I',7);
$this->Write (5, 'MCR Electronic S.L. Inscrita en el Registro Mercantil de Madrid en Tomo 15819, folio 163, Seccion 8ª, hoja M-267058, CIF: B82766452');
$this->SetTextColor(0,0,0);
}
}
$pdf=new PDF();
$pdf->Open();
$pdf->AddPage('P');
$pdf->SetDisplayMode(real,'default');
$pdf->SetAuthor('Company S.L');
$pdf->SetTitle('Factura MCR');
$pdf->$DocNum = $DocNum;
$pdf->$cliente = $cliente;
$pdf->$noCliente = $noCliente;
$pdf->$noTienda = $noTienda;
$pdf->$noPedido = $noPedido;
?>
請更具體地說明它是如何「不工作」的。 – 2009-08-18 19:00:39
您可能希望移除'var',因爲它已被棄用 – 2009-08-18 19:00:46
@ Chacha102,它已從PHP 5.3撤銷棄用 – 2009-08-18 19:09:17