get($token); if(!$vars){ throw new TokenException(); }else{ if(!is_array($vars)) { $vars = json_decode($vars, true); return $vars; } if (array_key_exists($key, $vars)) { return $vars[$key]; } else{ throw new Exception('尝试获取的Token变量并不存在'); } } } public static function getCurrentUid(){ $uid = self::getCurrentTokenVar('uid'); return $uid; } public static function isValidOperate($checkedUID){ if(!$checkedUID){ throw new Exception('检测UID时必须传入一个被检测的UID'); } $currentOperateUID = self::getCurrentUid(); if($currentOperateUID == $checkedUID){ return true; } return false; } }