问题
I have this piece of code, which uses Codeigniter's native Pagination Class.
$this->load->library('pagination');
$config['base_url'] = base_url().'notification/display_notification_info/'.$notification_id;
$config['total_rows'] = $totalRows;
$config['per_page'] = $per_page;
$this->pagination->initialize($config);
echo $this->pagination->create_links();
It shows the last page by default. So, the links are displayed like so:
< 1, 2, 3
It doesn't show the last page's URL. It should be:
base_url/3
Where is my mistake?
回答1:
If your actual page is your last page by default, then it will not show a URL. But you can still to force it url to current page
回答2:
is the url correctly formed (yourdomain.com/notification/display_notification_info/'.$notification_id)? don't use base_url()..use site_url() try it
$config['base_url'] = site_url('notification/display_notification_info/'.$notification_id);
来源:https://stackoverflow.com/questions/21049350/codeigniter-pagination-create-links