cakephp编辑功能中的消息未闪烁

cakephp编辑功能中的消息未闪烁,cakephp,cakephp-1.3,Cakephp,Cakephp 1.3,我敢肯定,对于一些人来说,这是一个简单的问题。函数本身正在执行所请求的操作,但在执行操作时消息不会闪烁 功能如下: function edit($id = null) { if($this->Auth->user('id')==$id) { $this->set('user', $this->User->read(null, $id)); } else {

我敢肯定,对于一些人来说,这是一个简单的问题。函数本身正在执行所请求的操作,但在执行操作时消息不会闪烁

功能如下:

function edit($id = null) {
            if($this->Auth->user('id')==$id) {
                $this->set('user', $this->User->read(null, $id));
                } else {
                    $this->Session->setFlash(__('You are not authorized to edit other member profiles', true));
                    $this->redirect(array('action' => 'index'));
        }
        if (!empty($this->data)) {
            if ($this->User->save($this->data)) {
                $this->Session->setFlash(__('Member profile saved', true));
                $this->redirect(array('action' => 'index'));
            } else {
                $this->Session->setFlash(__('Member profile could not be saved. Please, try again.', true));
            }
        }
        if (empty($this->data)) {
            $this->data = $this->User->read(null, $id);
        }
        $groups = $this->User->Group->find('list');
        $this->set(compact('groups'));
    }

仍然在学习cakephp的诀窍,并激发一些非常古老的PhP技能——所以请容忍我!谢谢

在下面添加另一行

echo $this->Session->flash('auth');
像这样:

echo $this->Session->flash();
这将显示常规的flash消息


将“auth”传递给flash方法只会显示auth flash消息,而不会显示其他消息。有关更多信息,请参阅。

您是否有
echo$this->Session->flash()在布局(或视图)中?@mattb echo$this->Session->flash('auth');坐在布局中。我简直不敢相信事情竟如此简单——我差点就被控制器弄得乱七八糟。。非常感谢!!任何时候,很高兴我能帮忙:-)