我是codeigniter分页的新手。我试图通过数组值配置 per_page 。这是我试过的例子:
//dynamic limit
$limit = array(10, 20, 30);
if (!is_null($offset)) {
$offset = $this->uri->segment(2);
}
$config['uri_segment'] = 2;
$config['base_url'] = site_url('product');
$config['total_rows'] = $this->mod_product->count_item();
$config['per_page'] = $limit;
$config['num_links'] = 10;
$this->pagination->initialize($config);
$data['links'] = $this->pagination->create_links();
$data['items'] = $this->mod_product->get_product($limit, $offset);
$this->load->view("product", $data);