我正在使用每页 20 结果的 codeigniter 分页,但是当我单击分页平均页码时,它只得到两个结果,例如 2、3、4 以下是我的控制器
function restaurant_listing()
{
$config['base_url'] = base_url() . 'admin/restaurant/restaurant_listing/';
//$config['base_url'] = "http://".$_SERVER['HTTP_HOST'];
//$config['base_url'] .= preg_replace('@/+$@','',dirname($_SERVER['SCRIPT_NAME'])).'/';
$config['total_rows'] = $this->restaurant_model->record_count();
$config['per_page'] = 20;
$config['uri_segment'] = 4;
$config['num_links'] = 10;
$config['use_page_numbers'] = TRUE;
$config['cur_tag_open'] = '<b>';
$config['cur_tag_close'] = '</b>';
$this->pagination->initialize($config);
$page = ($this->uri->segment(4)) ? $this->uri->segment(4) : 0;
$data["results"] = $this->restaurant_model->restlisting($config["per_page"], $page);
$data["links"] = $this->pagination->create_links();
$data['content'] = $this->load->view('admin/restaurant_listing', $data, true);
$this->load->view('admin/template', $data);
}
我的视图文件包含
<div class="pagination"> <?php echo $links; ?> </div>
我在这里显示分页