zoukankan      html  css  js  c++  java
  • php(tp5)实现分页效果

          public function admin(){
            if(request()->isPost()){
              //获取第二页的数据传current = 2过来即可
              $post['origin'] = input('origin');
                    $post['lenght'] = input('lenght');
                    $post['current'] = input('current');
                    //当前数据开始查询位置
                    if ( !isset($post['origin']) || empty($post['origin']) ) {
                        $post['origin'] = 0 ;
                    }
    
                    //每页显示多少条数据
                    if ( !isset($post['lenght']) || empty($post['lenght']) ) {
                        $post['lenght'] = 6 ;
                    }
    
                    //当前页
                    if ( isset($post['current']) && !empty($post['current']) && $post['current']>=1 ) {
                        $data['current'] = ceil($post['current']);
                        if (($data['current']-1)>=1){
                            $post['origin'] = ($post['current']-1) * $post['lenght'];
                        }
                    }else{
    
                        $data['current'] =  $post['origin'] / $post['lenght'];
                    }
    
    
                    $data['lenght'] = $post['lenght'];
                    if ($data['current']<=1) {
                        $data['current'] = 1;
                    }
              //数据    
                    $data['data'] = AdminModel::admin_lst($post['origin'],$post['lenght']);
    
                    //数据总条数
                    $data['count'] = StudyModel::rules_count();
    
                    //总页数
                    $data['page'] = ceil($data['count'] / $data['lenght']); 
              return json(['code'=>1,'data'=>$data]);         }       }
  • 相关阅读:
    SerializationUtility
    ExtendHelper
    AutoTransformHandler
    Parameter Config
    Tools Function
    谈谈对C#中反射的一些理解和认识(上)
    WPF程序中App.Config文件的读与写
    WPF实现Windows资源管理器(附源码)
    安装VC++2015运行库时出现0x80240037错误
    对C#调用C++的dll的一点思考
  • 原文地址:https://www.cnblogs.com/junyi-bk/p/11507959.html
Copyright © 2011-2022 走看看