![](/img/trans.png)
[英]Yii::app()->user->isGuest returns true after redirection..?
[英]Yii::app()->user->isGuest is returning null
Yii :: app()-> user-> isGuest引發異常
"Uncaught exception 'CException' with message 'Property "CWebUser.email" is not defined."
我該如何解決這個錯誤?
因為您沒有設置電子郵件。 在“受保護->組件-> UserIdentity.php”中打開文件。 添加$this->setState('email', $user->email)
如下。
$this->_id=$user->id;
$this->username=$user->username;
$this->setState('email', $user->email);
變量username
必須在CWebUser
類中使用。 如果要使用用戶電子郵件作為用戶名,則必須將email
分配email
username
變量。 您可以在Larry Ullman的頁面上找到有關如何執行此操作的更多信息:
http://www.larryullman.com/2010/01/07/custom-authentication-using-the-yii-framework/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.