|
新手求教
我在分页里面添加了mp_cache缓存,但是点击分页的时候分页列表不能切换。
代码如下:
$this->load->library('pagination');
$config['base_url'] =site_url().'/news/index';
$limit=$config['per_page'] = 3;
$offset=$this->uri->segment(3);
$config['total_rows'] = $this->newsmodel->total_num();
$this->pagination->initialize($config);
$data=$this->mp_cache->set_name('news/newlist')->get();
if($data===false)
{
$data['newlist']=$this->newsmodel->news_list($limit,$offset);
$this->mp_cache->set_name('news/newlist')->set_contents($data)->write();
}
$data['pagina']= $this->pagination->create_links();
$this->load->view('news/indexview',$data); |
|