【问题标题】:Is there a way to make pagination on 4th segment in codeigniter?有没有办法在codeigniter的第4段进行分页?
【发布时间】:2015-03-23 09:00:30
【问题描述】:

所以,这是我的网址:http://example.com/ci/index.php/home/sort_by_week 如您所见,我的第 3 段是 sort_by_week,但我需要在此页面上进行分页,有没有办法获得第 4 段?我已经尝试在分页脚本中执行 $this->uri->segment(4),但没有成功。有人可以帮助我并详细解释如何完成这项工作吗?

【问题讨论】:

    标签: php codeigniter pagination segment


    【解决方案1】:

    是的兄弟,你可以很容易地处理它

    $this->load->library('pagination');
    
    $config['base_url'] = 'http://example.com/ci/index.php/home/sort_by_week';
    $config['total_rows'] = 100;
    $config['per_page'] = 10;
    $config['uri_segment'] = 4; 
    
    $this->pagination->initialize($config); 
    
    echo $this->pagination->create_links();
    

    您必须输入此 $config['uri_segment'] = 4; 以便 codeigniter 可以在第 4 段设置您的分页。

    欲了解更多信息:Codeigniter Pagination Library

    【讨论】:

    • 欢迎兄弟 :) 保重
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-22
    • 1970-01-01
    • 2014-10-26
    • 2018-05-24
    相关资源
    最近更新 更多