在我的视图页面中,我调用了此函数
<a href="<?php echo base_url();?>verify/pdf/<?php echo $row>invoice_no;?>" ><button>Generated Pdf</button></a>
我的控制器
<?php
function pdf($id)
{
$data = [];
$this->load->database();
$this->load->model('useradmin');
$data['dealer'] = $this->useradmin->selectdealer($id);
$data['dealerdes'] = $this->useradmin->selectdealer1($id);
// load the view and saved it into $html variable
$html = $this->load->view('envoice', $data, true);
// this the the PDF filename that user will get to download
$pdfFilePath = "output_pdf_name.pdf";
// load mPDF library
$this->load->library('m_pdf');
// generate the PDF from the given html
$this->m_pdf->pdf->WriteHTML($html);
// download it.
$this->m_pdf->pdf->Output($pdfFilePath, "D");
}
如果我通过了函数pdf();没有参数,它的工作但动态内容不会显示在我的PDF中。
请建议如何将id传递给我的函数。