Codeigniter分页不显示分页

时间:2019-01-09 08:39:19

标签: php codeigniter

我试图进行分页,但是我有一个分页无法创建链接的问题

是我的控制者


    public function getByDept($idDept = NULL, $offset = NULL) {    
      $config = array ( 'base_url'   => site_url('emp/emp/getByDept'),
                        'total_rows' => count($this->employee->get(array('idDept' => $idDept))),
                        'uri_segment'=> $this->uri->total_segments()
                      );
      $this->pagination->initialize($config);

      echo $this->uri->total_segments();

      $data['employee'] = $this->employee->get(array('idDept' => $idDept, 'limit' => 2, 'offset' => $offset));
      $data['pagings']  = $this->pagination->create_links();

      $this->load->view('emp/default', $data);
    }

这就是我的观点


        <div class="row">
            <?php foreach ($employee as $row) : ?>
            <div class="col-xs-12 col-sm-6 col-md-6 margin-bottom-60px">
              <div class="well well-sm">
                  <div class="col-sm-6 col-md-8">
                    <h4><?php echo $row["emp_name"];?></h4>                      

                    <button class="btn btn-secondary btn-xs" onclick="view_master('<?php echo $row["id_aphris"] ?>')">Detail</button>
                  </div><!-- /.col-sm-6 col-md-8 -->
                </div><!-- /.row -->
              </div><!-- /.well well-sm -->
            </div><!-- /.col-xs-12 col-sm-6 col-md-6 -->
            <?php endforeach ?>

    <div id="paging">
                    <?php 
                        echo $pagings; 
                        var_dump($pagings);
                    ?>
                </div><!-- /.pagination -->
        </div>

请问我的问题代码在哪里?

1 个答案:

答案 0 :(得分:0)

也发布您的观看代码。

var_dump($pagings);使用您的观看代码会得到什么?

无论如何,我认为$ this-> uri-> total_segments();上存在一些问题。