PHP code
来源:互联网 发布:金蝶erp软件介绍 编辑:程序博客网 时间:2024/06/05 06:32
/** * 简单封装分页列表 * @param string $model_name 表名 * @param array $where 查询条件,同thinkphp原生 * @param string $alias 表别名,同thinkphp原生 * @param string $join 同thinkphp原生 * @param string $field 同thinkphp原生 * @param string $order 同thinkphp原生 * @return array 结果中status为返回状态,true:成功|false:失败 */ public function page_list($model_name = '', $alias = '', $where = [], $join = '', $field = '', $order = '', $group = '') { try { $status = true; $message = 'success'; $model = M($model_name); if ($group != "") { $subQuery = $model->alias($alias)->where($where)->join($join)->field($field)->group($group)->order($order)->buildSql(); $count = $model->table($subQuery.' a')->where()->order()->count(); } else { $count = $model->alias($alias)->where($where)->join($join)->field($field)->group($group)->order($order)->count(); } $page_size = 1; $page = new \Page($count, $page_size); $list = $model->alias($alias)->where($where)->join($join)->field($field)->group($group)->page($page->page . ',' . $page_size)->order($order)->select(); $page_string = $page->setListCount(2) ->setText('<p class="fl no_bod">共 {TOTAL} 条</p><p class="fl no_bod">每页 {LIMIT} 条</p>') ->setPrev('<a class="fl bod" href="javascript:reload_page_list(\'#\')">上一页</a>', '<p class="fl bod">上一页</p>') ->setList('<a class="fl bod" href="javascript:reload_page_list(\'#\')">__PAGE__</a>', '<p class="fl bod cur_bod">__PAGE__</p>') ->setNext('<a class="fl bod" href="javascript:reload_page_list(\'#\')">下一页</a>', '<p class="fl bod">下一页</p>') ->show(); } catch (\Exception $e) { $status = false; $message = $e->getMessage(); } return [ 'status' => $status, 'message' => $message, 'count' => $count, 'page_size' => $page_size, 'list' => $list, 'page_string' => $count != 0 ? $page_string : '', ]; }
0 0
- php code
- PHP code
- php code test
- php code test
- php qr code
- Plesk PHP Code Injection
- php webshell code
- PHP code coverage QuickStart
- test the php code
- PHP QR Code
- PHP 生成 QR Code
- clean-code-php
- Good and Bad PHP Code
- Php Endangers - Remote Code Execution
- Php Code Audits的方向
- drupal Execute custom PHP code
- 09-13 PHP study code
- Learning PHP Code injection 【I】
- 封装为什么能够提高代码的复用性
- 动态规划路径最小问题
- HOJ 1597 find the nth digit(贪心)
- JSP中使用JDBC操作数据库
- 蚂蚁分类信息系统 5.8 地区增加多级分类
- PHP code
- PHP上传图片和视频 问题处理(初学者)
- C# 文件管理及文件的读写
- Linux查看硬件配置信息(Cpu、硬盘、内存)
- Android开发中数据的5种存储方式简介.txt
- PAT甲级练习1070. Mooncake (25)
- 【BZOJ 2141】排队【分块+Treap】
- 【模板】【数论】扩展欧几里得算法
- mysql之表复制