我想知道在用户更新信息后如何重新加载数组(Auth.User).
目前这种情况不会发生,直到用户退出然后再加载到加载阵列(Auth.User)时.
到目前为止,我已经尝试了一些解决方案,如.
我也尝试过添加
$user = $this->User->field('name', array('User.id' => $this->Session->read('Auth.User.id')));
$this->Session->write('Auth.User', $user);
到app控制器中.
但没有一个成功.
谢谢
我是新手蛋糕,我试图在保存事件后让函数重定向..它可以在其他代码中工作,例如用户,但不在事件中...
功能可以保存事件,它只需要重定向或使用SETFLASH
这是我的事件控制器添加功能的代码:
public function add() {
if ($this->request->is('post')) {
$this->Event->create();
if ($this->Event->save($this->request->data)) {
$this->Session->setFlash(__('The event has been saved'));
$this->redirect(array('action' => 'eventmanage'));
} else {
$this->Session->setFlash(__('The event could not be saved. Please, contact the administrator.'));
}
}
}
Run Code Online (Sandbox Code Playgroud)
任何帮助都会非常感谢!