1234567891011121314151617181920212223242526272829303132 |
- <?php
- /**
- * +
- * | 后台中间件验证权限
- */
- namespace app\admin\middleware;
- use app\admin\model\AuthRule;
- use think\facade\Db;
- use think\facade\Session;
- use think\facade\Request;
- use think\Response;
- use think\exception\HttpResponseException;
- class AdminLog
- {
- public function handle($request, \Closure $next)
- {
- //进行操作日志的记录
- \app\admin\model\AdminLog::record();
- //中间件handle方法的返回值必须是一个Response对象。
- return $next($request);
- }
- //中间件支持定义请求结束前的回调机制,你只需要在中间件类中添加end方法。
- public function end(\think\Response $response)
- {
- // 回调行为
- }
- }
|