当前位置: 首页>>代码示例>>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;未经允许,请勿转载。