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类已经上传

  • 相关阅读:
    NC nc5.x报表设置合计行是否显示
    NC 单据保存时间过长,判断数据库锁表解决办法
    NC JDK报tools.jar错误(61版本)
    Python 基本语法 学习之路(三)
    html history
    页面跳转
    Html5 学习系列(六)Html5本地存储和本地数据库
    微信支付
    jquery分析网址
    在一个js文件中引用另一个js文件
  • 原文地址:https://www.cnblogs.com/yangzailu/p/6337048.html
Copyright © 2011-2022 走看看