1.在thinkPHP控制器类使用命名空间
2.把Page.class.PHP放入到该目录
3.
assign('status',$status);
$cuername=session('user.name');
$repair = M('repairinfo');
$count=$repair->where(array('cuername' =>$cuername))->count();查询总数
/*实例化分页类 传入总记录数和每页显示的记录数*/
$Page = new Page($count,10);//
/*分页显示输出*/
$show = $Page->show();
/*进行分页数据查询 注意limit方法的参数要使用Page类的属性*/
$page=I('param.p'); <span style="color: #ff0000">//接收<a href="https://www.jb51.cc/tag/qiantai/" target="_blank" class="keywords">前台</a>参数p位置</span>
if(empty($page)){
$page=1;
}
$list=$repair->where(array('cuername' =>$cuername))->order('applytime desc')->limit($Page->firstRow.",".$Page->listRows)->select();<span style="color: #ff0000"> //<a href="https://www.jb51.cc/tag/fenye/" target="_blank" class="keywords">分页</a></span>
$this->assign('list',$list); <span style="color: #ff0000">//<a href="https://www.jb51.cc/tag/shuchu/" target="_blank" class="keywords">输出</a>结果</span>
$this->assign('page',$show); <span style="color: #ff0000"> //<a href="https://www.jb51.cc/tag/shuchu/" target="_blank" class="keywords">输出</a><a href="https://www.jb51.cc/tag/fenye/" target="_blank" class="keywords">分页</a></span>
$mobile = parent::isMobile();
if($mobile=="true"){
$this->display(Wap_Repair);
}else{
$this->display(Repair);
}
}</span></pre>
4.前台接收{$page}
5.css样式
6.class类已经上传
原文链接:https://www.f2er.com/thinkphp/67926.html