首页 > 代码库 > thinkphp-分页

thinkphp-分页

 

 

  

    //进行分页

$user=D(‘Sks‘);
$count=$user->count();
$page=new \Think\Page($count,2);  //每页两个
$page->setConfig(‘first‘,‘首页‘);
$page->setConfig(‘prev‘,‘上一页‘);
$page->setConfig(‘next‘,‘下一页‘);
$page->setConfig(‘last‘,‘末页‘);
$show=$page->show();
$list=$user->order(‘date‘)->limit($page->firstRow.‘,‘.$page->listRows)->select();
$this->assign(‘list‘,$list);
$this->assign(‘page‘,$show);
$this->display();

thinkphp-分页