~~~
<?php
namespace app\common\controller;
use think\Controller;
use think\Session;
//用户身份授权基类
class Authorized extends Controller
{
public function _initialize()
{
//判断(当前作用域)是否赋值
if (!Session::has('CURRENT_USER')) {
$output['success'] = false;
$output['msg'] = '未授权操作请求,请先登录';
_callback($output);
}
}
}
~~~
1. 针对登录用户的身份验证