0

我可以添加分页,但从第 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');
4

2 回答 2

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);
于 2013-11-06T06:03:52.567 回答
0

请更换

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

于 2013-11-07T04:27:14.217 回答