我想将输入的数据作为数组传递到另一个将转换为pdf的表单,这是我的控制器代码
控制器
public function printReport(){
$data['report'] = array(
'date' => $this->input->post('date'),
'applicant_name' => $this->input->post('applicant-name'),
'permit_type' => $this->input->post('permit-type'),
'project_type' => $this->input->post('project-type'),
'total_amount' => $this->input->post('amount-paid'),
); // pass data to the view
$
$applicant = $this->input->post('date');
// As PDF creation takes a bit of memory, we're saving the created file in /downloads/reports/
$pdfFilePath = "C:/Users/Kevin/Desktop/$applicant.pdf";
if (file_exists($pdfFilePath) == FALSE){
ini_set('memory_limit','32M'); // boost the memory limit if it's low <img src="http://davidsimpson.me/wp-includes/images/smilies/icon_wink.gif" alt=";)" class="wp-smiley">
$html = $this->load->view('print-report', $data, true); // render the view into HTML
$this->load->library('pdf');
$pdf =$mpdf=new mPDF('utf-8', 'LEGAL');
$pdf->WriteHTML($html); // write the HTML into the PDF
$pdf->Output($pdfFilePath, 'I'); // save to file because we can
}
}
视图
<?php foreach ($report as $row):?>
<li><?php echo $row->applicant_name;?></li>
<?php endforeach;?>
它没有返回任何结果。