`
ynial
  • 浏览: 225770 次
  • 来自: ...
社区版块
存档分类
最新评论

有关 codeigniter pagination 的注意事项

PHP 
阅读更多
第一次 使用ci 的 pagination 的时候 很马虎、忘记配置$config['uri_segment']
如果你的分页引用 在没有任何参数的时候 使用api里的代码是没有问题的
$this->load->library('pagination');
$config['base_url'] = 'http://example.com/index.php/test/page/';
$config['total_rows'] = '200';
$config['per_page'] = '20'; 
$this->pagination->initialize($config); 
echo $this->pagination->create_links();

--
但是如果 你的应用url如果是这样
[http://example.com/index.php/test/page/beijing/]
显然多一个参数 那么多参数的情况下一定要设置
$config['uri_segment']  默认的情况下是3
根据你的参数不同 设置 $config['uri_segment']的值

否则 你的分页 显示后 总是第一页 不会变的!开始以为是bug 后来认真看了一下文档了解自己马虎了!

呵呵
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics