Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Codeigniter 如何将检索数据限制为30,其他30将在pdf的下一页中介绍_Codeigniter_Mpdf - Fatal编程技术网

Codeigniter 如何将检索数据限制为30,其他30将在pdf的下一页中介绍

Codeigniter 如何将检索数据限制为30,其他30将在pdf的下一页中介绍,codeigniter,mpdf,Codeigniter,Mpdf,我希望将检索到的数据限制为30,并希望其他30个数据出现在pdf的下一页。。这是我第一次使用强积金 我的控制器 public function print_rel(){ //die(); $data['rec'] = $this->home_model->get_latest_data(); //print_r($data['rec']);die(); $html = $this->load->view('print_rel',$data

我希望将检索到的数据限制为30,并希望其他30个数据出现在pdf的下一页。。这是我第一次使用强积金

我的控制器

public function print_rel(){
    //die();

    $data['rec'] = $this->home_model->get_latest_data();
    //print_r($data['rec']);die();
    $html = $this->load->view('print_rel',$data, true);
    $this->load->library('pdf');
    $pdf = $this->pdf->load();

    $pdf->AddPage('P', // L - landscape, P - portrait
    '', '', '', '',
    10, // margin_left
    10, // margin right
    40, // margin top
    0, // margin bottom
    14, // margin header
    12);  
    $pdf->WriteHTML($html);

    $pdf->Output();
}
我的查看页面

<?php $i='1' ; $total = ''; foreach ($rec->result_array() as $key){    ?>
<tr>

    <td  class="centerthis"><?php echo "$i"; ?></td>
    <td  class="centerthis"><?php $date = new DateTime($key['date_reg']); echo $date->format('m-d-Y');?></td>
    <td  class="centerthis"><?php echo $key['lname'] ?></td>    
    <td  class="centerthis"><?php echo $key['fname'] ?></td>
    <td  class="centerthis"><?php echo $key['mi'] ?></td>
    <td  class="centerthis"><?php $date = new DateTime($key['bdate']); echo $date->format('m-d-Y');  ?></td>
    <td  class="centerthis"><?php echo $key['amount'] ?></td>



只需使用限制功能40,然后使用40,80查询第二页。你能给我一个foreach的例子来添加一个新页面吗?我希望数据在生成后出现在pdf的下一页