我使用CodeIgniter和dompdf生成pdf有问题,我的代码是:
public function generateTitlePage($name = '', $surname='', $number='', $village='')
{
$this->load->library('dompdf_gen');
$dompdf = new DOMPDF();
$html = <<<HTML
<html>
<body>
<h1>Hello:$name</h1><br />
<h1>Hello:$surname</h1><br />
<h1>Hello:$number</h1><br />
<h1>Hello:$village</h1>
</body>
</html>
HTML;
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("welcome.pdf");
}
此功能的结果是
Hello: Name Surname number village
Hello:
Hello:
Hello:
但我需要将其分开:
Hello:Name
Hello:Surname
Hello:number
Hello:village
请帮帮我。 该函数被称为:
<a href="<?=base_url()."dosar/generateTitlePage($d[name]$d[surname]$d[number]$d[village])" ?>" class="btn btn-primary btn-sm marg-top-10">Generate</a>
答案 0 :(得分:2)
您生成网址的方式不正确您需要了解routing first
之类的
example.com/class/function/id/
example.com/class/function/parameter1/parameter2/parameter3/
对于您的pdf网址,您可以按以下方式编写锚点
<a href="<?=base_url().'dosar/generateTitlePage/'. $d[name] .'/'. $d[surname] .'/'. $d[number] .'/'. $d[village])' ?>" class="btn btn-primary btn-sm marg-top-10">Generate</a>