USER = $user; } /** * 获取用户登录信息 * @param string $key 用户字段,填写则获取固定字段值,不填写则返回全部 * @return array|mixed|string */ public function get(string $key = '') { if (!empty($key)){ $field = $this->USER[$key] ?? ''; } return $field ?? $this->USER; } /** * 校验 * @return bool */ public function check(): bool { if (empty($this->USER)) return false; return true; } }