Home > php教程 > PHP开发 > Use of CI framework paging class (2)

Use of CI framework paging class (2)

黄舟
Release: 2016-12-29 09:46:52
Original
1271 people have browsed it

$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);    //偏移位置
Copy after login
$this->db->limit($perPage,$offset);   //进行数据库中的分页数据
Copy after login

The above is the content of the use of CI framework paging class (2). For more related content, please pay attention to the PHP Chinese website (m.sbmmt.com)!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template