用户
 找回密码
 入住 CI 中国社区
搜索
查看: 2089|回复: 0
收起左侧

[库 Library] 一个分页类

[复制链接]
发表于 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语句计算出总行数。


简单使用
PHP复制代码
 
 
$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();
 
 
 
复制代码

本版积分规则