Python语言技术文档

微信小程序技术文档

php语言技术文档

jsp语言技术文档

asp语言技术文档

C#/.NET语言技术文档

html5/css技术文档

javascript

点击排行

您现在的位置:首页 > 技术文档 > php框架

ThinkPHP3.2.3结合Laypage实现的分页功能示例

来源:中文源码网    浏览:317 次    日期:2024-05-11 04:31:37
【下载文档:  ThinkPHP3.2.3结合Laypage实现的分页功能示例.txt 】


thinkPHP3.2.3结合Laypage实现的分页功能示例
本文实例讲述了thinkPHP3.2.3结合Laypage实现的分页功能。分享给大家供大家参考,具体如下:
控制器
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
/**
*@brief 查询
****/
public function index(){
$choose = I('choose','-6');
$c['easy_hard'] = $choose;
$type=I('typeid','');
$nowpage=I('page',1);
if($type == '')
{
if($choose == -6)
{
$totalpage=ceil((D('data')->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();
}
}
视图层




Think Demo








{$type} " id="type">


















ID语言难易程度操作
{$vo.id}{$vo.data}
简单
一般


删除
修改







更多关于thinkPHP相关内容感兴趣的读者可查看本站专题:《ThinkPHP入门教程》、《thinkPHP模板操作技巧总结》、《ThinkPHP常用方法总结》、《codeigniter入门教程》、《CI(CodeIgniter)框架进阶教程》、《Zend FrameWork框架入门教程》及《PHP模板技术总结》。
希望本文所述对大家基于ThinkPHP框架的PHP程序设计有所帮助。

相关内容