我的分页没有正常工作它有一些问题
这是我的控制器
$this->load->library('pagination');
$query= $this->db->get('invoice','5', $this->uri->segment(3));
$data['invoices']=$query->result();
//enter code here
$query2=$this->db->get('invoice');
$config['base_url'] = '/dashboard/billing';
$config['total_rows'] =$query2->num_rows();
$config['per_page'] = 5;
$config ['full_tag_open'] = '<ul class="pagination">';
$config ['full_tag_close']='</ul>';
$config ['first_tag_open'] = '<li class="page-item page-link ">';
$config ['last_tag_open']='<li class="page-item page-link">';
$config ['next_tag_open'] = '<li class="page-item page-link ">';
$config ['perv_tag_open']='<li>';
$config ['num_tag_open'] = '<li class="page-item page-link">';
$config ['num_tag_close']='</li>';
$config ['first_tag_close'] = '</li>';
$config ['last_tag_close']='</li>';
$config ['next_tag_close'] = '</li>';
$config ['perv_tag_close']='</li>';
$config ['cur_tag_open'] = '<li class="page-item active page-link ">';
$config ['cur_tag_close']='</li>';
$this->pagination->initialize($config);
$this->pagination->create_links();
$this->load->view('dash_billing',$data);
我将$ data转移到视图中并使用foreach循环运行 我得到一些错误,如
1)无法点击第1页(实际上是在第2页打开)
3)下一个按钮只能工作一次
4)当我点击最后一个按钮时,我可以看到所有其他链接但没有正常工作
答案 0 :(得分:0)
我用这行代码解决了
$ config [&#39; use_page_numbers&#39;] = TRUE;