TP分页
$model_location = M('location'); $page_count_location = $model_location->count();//获得数据库里面数据的数量,用于分页 $page = new \Think\Page($page_count_location,5);// $startno = $page->firstRow;//起始行数 $pagesize = $page->listRows;//页面大小 $this->lastSuffix = false; $page->setConfig('prev','上一页'); $page->setConfig('next','下一页'); $page->setConfig('first','首页'); $page->setConfig('last','末页'); $show = $page->show(); $this->assign('page_location',$show);//页码 $list_location = M()->query("select location.locationid,location.casename,b.username as username1,c.username as username2,location.supplytime,location.validtime,a.username,locationstatus.locationstatus,location.Content from location,user a,user b,user c,locationstatus where location.applyuserid = a.userid and locationstatus.LocationStatusId = location.locationstatus and location.CaseUserId = b.userid and c.userid = location.LocationUserId limit $startno,$pagesize");//进行数据库信息查询 $this->assign('list_location',$list_location);//获得申请的定位信息(管理员可以看到所有的定位信息)