登錄權限
阿新 • • 發佈:2019-01-05
think sta ret this fun key lag 權限 ssi
public function _initialize()
{
if (!Session::has(‘user‘, ‘think‘)) {
$this->error(‘非法登錄‘, ‘Login/index‘);
}
$this->get_date();
}
public function get_date(){
$controller = Request::instance()->controller();
$action = Request::instance()->action();
$node = Session::get("access","think");
$flag = false;
foreach($node as $key=>$value){
if($value[‘controller_name‘] == $controller && $value[‘action_name‘] == $action){$flag = true;}if($action=="page"){$flag=true;//如果該用戶中有權限則為true}}if($flag == false){$this->error("您沒有權限");
if(data.msg){alert(‘您沒有權限‘);return false;}
登錄權限