PHP code example of minuux / codeigniter-library-paginate
1. Go to this page and download the library: Download minuux/codeigniter-library-paginate library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
minuux / codeigniter-library-paginate example snippets
$this->load->library('paginate');
$this->db->start_cache();//需要缓存where语句,用于统计总行数
$this->db->where('field_name','field_value');
$this->paginate->filter(array('nickname'));
$this->db->from('view_recruits');
$this->db->stop_cache();
$this->db->order_by('id');//分页,必须指定排序规则
$this->paginate->get();
{
'total' => int,//总行数
'per_page' => int,//每页显示的行
'cur_page' => int,//当前页码
'num_page' =>int,//总页数
'data' => array(),//结果集
'links' => string//$this->pagination->create_links()返回的字符串
}