如果用户未登录,我将尝试将会话保存在用户试图输入的变量url中,因此,我重定向到登录URL,并且一旦成功地将其重定向回请求的网站。我的问题是,它没有保存会话变量,也没有保存其中的一个或另一个。
这在appController中
if($this->action!='logout' && $this->action!='logout_cas' && $this->action!='login_cas' && $this->action!='login'){
if(isset($_SESSION['cas_user'])){
$_SESSION['url_user'] = Router::url('', true);
$this->redirect(array('controller'=>'users','action'=>'login_cas'));
}
}这在函数UsersController中的login_cas中
if ($this->Auth->user('active') != '1') {
$active = $this->Auth->user('active');
$this->Session->destroy();
if($active < 0)
throw new Exception(__('Invalid user or password. Try again'));
throw new Exception(__('User blocked, contact your administrator'));
} else {
$_SESSION["user_login_errors"] = 0;
//$this->redirect(array('controller'=>'users','action'=>'home'));
$this->redirect($_SESSION['url_user']);
}消息通知(8):未定义索引: url_user
发布于 2016-02-25 16:57:49
当然,只有我的域名网页。问题解决了,我的代码在其他存储库中运行得很好,复制了站点,然后又重新开始工作了。不管怎么说,接受你的建议
$this->Session->write并阅读CakePHP。坦克斯!
https://stackoverflow.com/questions/24914774
复制相似问题