CI框架分页类的使用(2)
程序员文章站
2022-04-25 13:24:21
...
$this->load->model("article_model","art"); //载入分页类 $this->load->library('pagination'); $perPage = 2; //配置项设置 $config['base_url'] = site_url('admin/article/index'); $config['total_rows'] = $this->db->count_all_results('hd_article'); $config['per_page'] = $perPage; $config['uri_segment'] = 4; $config['first_link'] = '第一页'; $config['prev_link'] = '上一页'; $config['next_link'] = '下一页'; $config['last_link'] = '最后一页'; $this->pagination->initialize($config); $data['links'] = $this->pagination->create_links(); $offset = $this->uri->segment(4); //偏移位置
$this->db->limit($perPage,$offset); //进行数据库中的分页数据
以上就是CI框架分页类的使用(2)的内容,更多相关内容请关注PHP中文网(www.php.cn)!