Codeigniter分页我使用的是数据模型。我有5020张唱片。当我打开页面时,加载了所有记录,然后只进行了分页。所以加载需要很长时间。我需要在打开页面时直接显示页码。我尝试了很多没有人适合我的方法
You need to load pagination library :-
$this->load->library('pagination');
Than you need to set the values according to your choice
$config['per_page']= 10;
$config['uri_segment'] = 4;
$config['base_url'] = site_url('on which page you want to put the pagination').'/';
$this->data['per_page_display'] = $config['per_page'];
$config['total_rows'] = count( 'Get total records from your model');
$this->data['totalcount'] = $config['total_rows'];
$this->pagination->initialize($config);
$this->data['paginglinks'] = $this->pagination->create_links();
$this->data['per_page'] = $this->uri->segment(4);
$this->data['page'] = $offset;
Than you can use your pagination on your view