當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Authenticator::GetCurrentUser方法代碼示例

本文整理匯總了PHP中Authenticator::GetCurrentUser方法的典型用法代碼示例。如果您正苦於以下問題:PHP Authenticator::GetCurrentUser方法的具體用法?PHP Authenticator::GetCurrentUser怎麽用?PHP Authenticator::GetCurrentUser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Authenticator的用法示例。


在下文中一共展示了Authenticator::GetCurrentUser方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: GetCurrentUser

 /**
  * Returns the currently authenticated user, or null if a user has not been authenticated.
  *
  * @return IAuthenticatable || null
  */
 protected function GetCurrentUser()
 {
     if (!$this->_cu) {
         $this->Phreezer->Observe("Loading CurrentUser from Session");
         $this->_cu = Authenticator::GetCurrentUser($this->GUID);
         if ($this->_cu) {
             if (get_class($this->_cu) == "__PHP_Incomplete_Class") {
                 // this happens if the class used for authentication was not included before the session was started
                 $tmp = print_r($this->_cu, 1);
                 $parts1 = explode("__PHP_Incomplete_Class_Name] => ", $tmp);
                 $parts2 = explode("[", $parts1[1]);
                 $name = trim($parts2[0]);
                 Authenticator::ClearAuthentication($this->GUID);
                 throw new Exception("The class definition used for authentication '{$name}' must be defined (included) before the session is started, for example in _config.php.");
             } else {
                 $this->_cu->Refresh($this->Phreezer);
             }
         }
     } else {
         $this->Phreezer->Observe("Using previously loaded CurrentUser");
     }
     return $this->_cu;
 }
開發者ID:niceboy120,項目名稱:phreeze,代碼行數:28,代碼來源:Controller.php


注:本文中的Authenticator::GetCurrentUser方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。