zoukankan      html  css  js  c++  java
  • thinkphp分页

    1.在thinkphp控制器类使用命名空间

    2.把Page.class.php放入到该目录

    3.

    public function Repair(){
           $status=I('param.status','6');
            $this->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'); //接收前台参数p位置
            if(empty($page)){
                $page=1;
            }
            $list=$repair->where(array('cuername' =>$cuername))->order('applytime desc')->limit($Page->firstRow.",".$Page->listRows)->select(); //分页
            $this->assign('list',$list); //输出结果
            $this->assign('page',$show);  //输出分页
    
            $mobile = parent::isMobile();
            if($mobile=="true"){
              $this->display(Wap_Repair);
            }else{
                $this->display(Repair);
            }
        }

    4.前台接收{$page}

    5.css样式

    .manu{padding:3px;margin:3px;text-align:center;}
    .manu a{border:#ccc 1px solid;padding:3px 10px;margin:2px;color:#999;text-decoration:none;}
    .manu a:hover{border:#B5C8CF 1px solid;color:#fff;background-color:#B5C8CF;}
    .manu a:active{border:#999 1px solid;color:#666;}
    .manu .current{border:#B5C8CF 1px solid;padding:3px 10px;margin:2px;color:#fff;background-color:#B5C8CF;}
    .manu .disabled{border:#eee 1px solid;padding:2px 5px;margin:2px;color:#ddd;}

    6.class类已经上传

  • 相关阅读:
    LeetCode120 Triangle
    LeetCode119 Pascal's Triangle II
    LeetCode118 Pascal's Triangle
    LeetCode115 Distinct Subsequences
    LeetCode114 Flatten Binary Tree to Linked List
    LeetCode113 Path Sum II
    LeetCode112 Path Sum
    LeetCode111 Minimum Depth of Binary Tree
    Windows下搭建PHP开发环境-WEB服务器
    如何发布可用于azure的镜像文件
  • 原文地址:https://www.cnblogs.com/yangzailu/p/6337048.html
Copyright © 2011-2022 走看看