大家好我在main.PHP配置文件中有这个代码:
'components' => array( '[.........]','user'=>array( // enable cookie-based authentication 'allowAutoLogin'=>true,'autoRenewCookie' => true,'returnUrl' => 'https://stackoverflow.com',) );
我的问题是id登录后没有将用户重定向到https://stackoverflow.com,你能帮我吗?
UserController.PHP:
public function actionLogin() { if (!Yii::app()->user->isGuest){ $this->redirect('/user/index'); return; } $model=new LoginForm; // if it is ajax validation request if(isset($_POST['ajax']) && $_POST['ajax']==='login-form') { echo CActiveForm::validate($model); Yii::app()->end(); } // collect user input data if(isset($_POST['LoginForm'])) { $model->attributes=$_POST['LoginForm']; // validate user input and redirect to the prevIoUs page if valid if($model->validate() && $model->login()) $this->redirect(Yii::app()->user->returnUrl); } // display the login form $this->render('login',array('model'=>$model)); }