Hi I am confuse in checking the session.I tried this but no luck…After logout in my admin page,If I am going to click the browser back button It will have fatal error,because there is no session anymore…
Trying to get property of non-object
public function actionIndex()
{
if(Yii::$app->session->id !=null){
return $this->render('index');
}
return $this->redirect(array('site/index')); //back to my login page
}
public function actionLogout()
{
Yii::$app->user->logout();
return $this->redirect(array('site/index'));
}
How can I check the session if it no user logging-in ,I will redirect it to my login page.