Minux2007 发表于 2015-11-7 20:38:22

一个分页类

本帖最后由 Minux2007 于 2015-11-7 20:40 编辑


代码:https://github.com/minuux/codeigniter-paginate
使用$this->db->start_cache(),$this->db->stop_cache() 来缓存SQL语句计算出总行数。


简单使用


$this->load->library('paginate');

$this->db->select('*');
$this->db->start_cache();

$this->paginate->filter(array('nickname'));//可以通过URL直接筛选
$this->db->where('field_name','field_value');
$this->db->from('table');

$this->db->stop_cache();

$this->db->order_by('id');//分页,必须指定排序规则
$this->paginate->get();



页: [1]
查看完整版本: 一个分页类