2011-07-27 25 views
0

简单的问题对于一些我确信。这个函数本身就是在做什么,但是这个消息在执行时没有被闪现。下面消息不在cakephp中闪烁编辑功能

功能:

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技能 - 如此忍受我!谢谢!

+0

在布局(或视图)中是否有'echo $ this-> Session-> flash();'? –

+0

@mattb echo $ this-> Session-> flash('auth');坐在布局。 – Plastika

回答

0

添加另一条线下方

echo $this->Session->flash('auth'); 

像这样:

echo $this->Session->flash(); 

这将显示正常闪光消息

,把“权威性”到闪蒸法将只显示身份验证提示信息和没有其他的。有关更多信息,请参阅http://api13.cakephp.org/class/session-helper#method-SessionHelperflash

+0

我简直不敢相信那是那么简单 - 我靠近控制器拉扯头发。非常感谢! – Plastika

+0

任何时候,很高兴我可以帮助:-) –