分页codeigniter无法链接页面

时间:2013-11-06 05:01:57

标签: php codeigniter pagination

hy,我可以创建分页,但是从第1页无法链接到第2页......数据页2无法显示...可以帮助我? 我的代码:

$config['base_url']     =   base_url() . 'transaksi/index/';
$config['total_rows']   =   21;
$config['per_page']     =   10;
$config['uri_segment']  =   3;
$config['first_link']   =   'Awal';
$config['last_link']    =   'Akhir';
$config['next_link']    =   'Selanjutnya';
$config['prev_link']    =   'Sebelumnya';
$this->pagination->initialize($config);
$bc["paginator"]    =   $this->pagination->create_links();
$this->load->view('transaksidigor/bg_home',$bc);
自动加载

$autoload['libraries'] = array('database','session','pagination','form_validation','security');

![在此处输入图片说明] [1]

2 个答案:

答案 0 :(得分:0)

问题是你有base_url()缺少index.php我猜。相反,你应该总是使用site_url()。这样你或者设置了index.php,它总是会把你送到你要去的页面。

$config['base_url']     =   site_url('transaksi/index');
$config['total_rows']   =   21;
$config['per_page']     =   10;
$config['uri_segment']  =   3;
$config['first_link']   =   'Awal';
$config['last_link']    =   'Akhir';
$config['next_link']    =   'Selanjutnya';
$config['prev_link']    =   'Sebelumnya';
$this->pagination->initialize($config);
$bc["paginator"]    =   $this->pagination->create_links();
$this->load->view('transaksidigor/bg_home',$bc);

答案 1 :(得分:0)

请替换

  

$ config ['uri_segment'] = 3; to $ config ['uri_segment'] = $ this-> uri-> rsegment(3);