我收到此错误消息。请帮我解决这个问题。
致命错误:在第 38 行调用 C:\xampp\htdocs\sikembul\application\views\viw_slip_gaji.php 中未定义的方法 FPDF::check()
这是我的代码
<?php
$GLOBALS['a']=2;
$GLOBALS['alpha']=3;
$GLOBALS['beta']=5;
function check($num)
{
if ($num=="1")
{
global $a;
global $alpha;
global $beta;
$total = $a*$alpha*$beta;
$this->fpdf->Cell(50,5,'final',1,0,'L');
$this->fpdf->Cell(8,5,'xx.',1,0,'L');
$this->fpdf->Cell(20,5,$total,1,1,'R');
}
else
{
global $a;
global $alpha;
global $beta;
$total = $a-$alpha-$beta;
$this->fpdf->Cell(50,5,'final',1,0,'L');
$this->fpdf->Cell(8,5,'xx.',1,0,'L');
$this->fpdf->Cell(20,5,$total,1,1,'R');
}
}
$this->fpdf->FPDF('P','mm','A5');
$this->fpdf->SetMargins(10,10,10);
$this->fpdf->AddPage();
$this->fpdf->setFont('Times','B',9);
$this->fpdf->Cell(130,5,'Here Some Text to Display',0,1,'C');
$this->fpdf->check(1);
$this->fpdf->Output('generate.pdf','I');
?>
仅供参考,当我禁用该功能时一切正常。感谢所有的帮助和评论。