这篇文章主要介绍了thinkPHP3.2.3结合Laypage实现的分页功能,结合实例形式分析了thinkPHP3.2.3结合Laypage实现分页的model控制器与view视图相关操作技巧,需要的朋友可以参考下
本文实例讲述了thinkPHP3.2.3结合Laypage实现的分页功能。分享给大家供大家参考,具体如下:
控制器
count())/10); $infos=D('data')->limit(($nowpage-1)*10,10)->select(); }else{ $totalpage=ceil((D('data')->where($c)->count())/10); $infos=D('data')->where($c)->limit(($nowpage-1)*10,10)->select(); } }else{ if($choose == -6) { $map['data'] = array('like',"%$type%"); $totalpage=ceil((D('data')->where($map)->count())/10); $infos=D('data')->where($map)->limit(($nowpage-1)*10,10)->select(); }else{ $map['data'] = array('like',"%$type%"); $totalpage=ceil((D('data')->where($map)->where($c)->count())/10); $infos=D('data')->where($map)->where($c)->limit(($nowpage-1)*10,10)->select(); } } $this->assign('type',$type); $this->assign('choose',$choose); $this->assign("totalpage",$totalpage); $this->assign("infos",$infos); $this -> display(); }<p style="color:transparent">来源gao!%daima.com搞$代*!码网</p> }
视图层
<title>Think Demo</title> <div> <option value="-6" selected >全部<option value="0" selected >简单<option value="1" selected >一般<input type="text" value=" {$type} " id="type"><button id="sou">搜索</button></div><br><table border="1" width="500"> <tr> <th>ID</th><th>语言</th><th>难易程度</th><th>操作</th></tr> <tr> <th>{$vo.id}</th><th>{$vo.data}</th><th> 简单 一般 </th><th> 删除修改</th></tr></table><div style="margin-top:15px;text-align:center" id="page11"></div><button> 添加 </button><br />
更多关于thinkPHP相关内容感兴趣的读者可查看本站专题:《ThinkPHP入门教程》、《thinkPHP模板操作技巧总结》、《ThinkPHP常用方法总结》、《codeigniter入门教程》、《CI(CodeIgniter)框架进阶教程》、《Zend FrameWork框架入门教程》及《PHP模板技术总结》。
希望本文所述对大家基于ThinkPHP框架的PHP程序设计有所帮助。
以上就是thinkPHP3.2.3结合Laypage实现的分页功能示例的详细内容,更多请关注gaodaima搞代码网其它相关文章!