一、后台人员管理
1、在后台Action/Admin/下新建一个UserManageAction.class.php
代码:
class UserManageAction extends CommonAction { public function index() { import('ORG.Util.Page'); $count = M('user')->count(); $page = new Page($count, 10); $limit = $page->firstRow . ',' . $page->listRows; $users = M("user")->order('logintime Desc')->limit($limit)->select(); $this->users = $users; $this->page = $page->show(); $this->display(); } public function unlock() { $id = I('id', '', 'intval'); $re = M('user')->where('id=' . $id)->setField('lock', 0); if ($re) { $this->success('修改成功', U('Admin/UserManage/index')); } else { $this->error('修改失败'); } } public function lock() { $id = I('id', '', 'intval'); $re = M('user')->where('id=' . $id)->setField('lock', 1); if ($re) { $this->success('修改成功', U('Admin/UserManage/index')); } else { echo '没修改'; } } }
2、前台Tpl/Admin/新建 UserManage_index.html
显示员工的列表
<foreach name="users" item='v'> <tr> <td>{$v.id}</td> <td>{$v.username}</td> <td>{$v.password}</td> <td>{$v.logintime|date='Y--m-d H:i',###}</td> <td>{$v.loginip}</td> <td>{$v['lock']?'锁定':'未锁定'}</td> <td><a href="{:U('Admin/UserManage/unlock',array('id'=>$v['id']))}">解锁</a> <a href="{:U('Admin/UserManage/lock',array('id'=>$v['id']))}">锁定</a></td> </tr> </foreach>
注:<foreach>标签是通过thinkphp框架解析的<?php foreach ?>方法
二、使用分页类
1、后台Action中引入page类
代码:
public function index() { import('ORG.Util.Page');//引入分页类 $count = M('user')->count();//统计总数 $page = new Page($count, 10);//实例化每页显示10个 $limit = $page->firstRow . ',' . $page->listRows; $users = M("user")->order('logintime Desc')->limit($limit)->select(); $this->users = $users; $this->page = $page->show(); $this->display(); }
2、html 展示
<tr> <td colspan="7" align="center">{$page}</td> </tr>
代码请看附件:
相关推荐
NULL 博文链接:https://hefengjun1.iteye.com/blog/2333706
thinkphp问卷_问卷mvc_thinkphp_thinkphp问卷_问卷_thinkphp系统_源码.zip
thinkphp_thinkphp_thinkphp5_源码.zip
tp5开发的通用后台模板,权限管理+文章管理+幻灯片
NULL 博文链接:https://hefengjun1.iteye.com/blog/2333730
基于ThinkPHP6.0和AdminLTE3.1的后台管理系统源码 基于ThinkPHP6.0和AdminLTE3.1的后台管理系统源码 基于ThinkPHP6.0和AdminLTE3.1的后台管理系统源码 基于ThinkPHP6.0和AdminLTE3.1的后台管理系统源码 基于...
功能强大的后台管理集成代码、thinkphp、phpcmf
ThinkPHP5.0.5完整版_ThinkPHP_full_v5.0.5 欢迎关注PHP学习博客:http://blog.csdn.net/column/details/14209.html
115cms综合内容管理系统是一款采用当前最流行的ThinkPHP框架开发的高效开源的内容管理系统。本产品完全采用模块化开发,插件主题功能,增加了程序的维护性、可扩展性,使二次开发变得简单、容易,系统设计的模板标签...
thinkphp是一个基于thinkphp6的后台管理系统,对标laravel-admin。 think-admin特色: 1、composer库一键安装,丰富的配置项目 2、根据数据库自动生成增删改查,并生成相应的菜单和权限,减少基础机械重复工作 3、...
ThinkPHP-2.0-API的chm文件
课件管理系统,主要是用于老师的课件上传,课件基本管理等等
thinkphp开发模板,把常用的功能都写好了,可以直接使用
Thinkphp响应式进销存仓库管理系统
ThinkPHP是一个免费开源的,快速、简单的面向对象的轻量级PHP开发框架,遵循Apache2开源协议发布
使用ThinkPHP,你可以更方便和快捷的开发和部署应用
一个简单的thinkphp php类通用的管理员后台 适合初学者学习使用。 主要是续写如何给thinkphp 增加管理权限、增加登录后台共呢个
NULL 博文链接:https://hefengjun1.iteye.com/blog/2335818