From 83ae12748013211383e1f9fb9341956e4836cc18 Mon Sep 17 00:00:00 2001 From: Caiqy Date: Fri, 10 Jul 2020 18:26:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85Auth=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E8=B0=83=E7=94=A8user=E6=A8=A1=E5=9E=8B=E7=9A=84=E5=B1=9E?= =?UTF-8?q?=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/library/Auth.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/application/common/library/Auth.php b/application/common/library/Auth.php index 4356bac2f..531385188 100644 --- a/application/common/library/Auth.php +++ b/application/common/library/Auth.php @@ -70,6 +70,14 @@ class Auth return $this->_user ? $this->_user->$name : null; } + /** + * 兼容调用user模型的属性 + */ + public function __isset($name) + { + return isset($this->_user) ? isset($this->_user->$name) : false; + } + /** * 根据Token初始化 * -- Gitee