我使用 codeigniter 分页类对我的记录进行分页,下面你可以看到我的代码
$data['success'] = "";
$data['error'] = "";
$data['offset'] = 0;
$this->load->library('pagination');
$per_page = 4;
$total = $this->m_workshop->totalworkshoppay();
$baseUrl = site_url('sitemanager/workshop/workshopayment');
$data['query'] = $this->m_workshop->getallwpay($per_page, (int) $this->uri->segment(4));
$confignew['base_url'] = $baseUrl;
$confignew['total_rows'] = $total;
$confignew['per_page'] = $per_page;
$confignew['uri_segment'] = '4';
$this->pagination->initialize($confignew);
$data['offset'] = (int) $this->uri->segment(4);
$this->load->view('sitemanager/workshop/viewallworkshoppay',$data);
我在我的视图页面中使用<?php echo $this->pagination->create_links(); ?>
代码来显示分页链接。但是分页链接没有显示在浏览器中。当我打印 $data['query']
时,记录会根据变量进行限制 $per_page
。