大家好!
我试图重写传递变量$ecm的Header方法,但是我得到了以下消息:
"Declaration of MYPDF::Header() should be compatible with TCPDF::Header()"你认为如何?我能绕过障碍吗?谢谢。
<code>
$pdf = new MYPDF('P', 'mm', 'A4');
$ecm="1241231.jpg";
$pdf->Header($ecm);
$pdf->Output('filename.pdf', 'I'); //To force download }
// Extend the TCPDF class to create custom Header and Footer
class MYPDF extends TCPDF {
//Page header
public function Header($ecm) {
....
}
}
</code>发布于 2014-04-21 10:35:44
$pdf = new MYPDF('P', 'mm', 'A4');
$ecm="1241231.jpg";
$pdf->setECM($ecm);
$pdf->Header();
$pdf->Output('filename.pdf', 'I'); //To force download }
// Extend the TCPDF class to create custom Header and Footer
class MYPDF extends TCPDF {
public $ecm;
public function setECM($ecm)
{
$this->ecm = $ecm;
}
//Page header
public function Header() {
$ecm = $this->ecm;
....
}
}https://stackoverflow.com/questions/23189075
复制相似问题