header('token'); if(!$token){ $token=Cookie::get('token'); } if(!$token){ $token=request()->get('token'); } if(!$token){ $token=request()->post('token'); } //$this->auth=ApiAuthService::newInstance(['adapter'=>new $class($token)]); $actionname = $this->request->action(); $noNeedLoginSet=is_string($this->noNeedLogin)?[$this->noNeedLogin]:$this->noNeedLogin; $noNeedLogin = in_array('*',$noNeedLoginSet) || in_array($actionname,$noNeedLoginSet); //需要登陆 // if(!$noNeedLogin && !$this->auth->isLogin()){ // $response = Response::create(__('请先登录!'), 'html', 401); // throw new HttpResponseException($response); // } } }