私は確信しています。関数自体は何を求めているのですが、メッセージは実行されてもフラッシュされません。以下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のスキルをキンドリング - ので、私と一緒にクマ!ありがとう!
echo $this->Session->flash();
これが唯一の認証フラッシュメッセージが表示されますフラッシュ法に 'AUTH' を渡し、通常のフラッシュメッセージ
を表示します:
あなたは 'エコーの$ this - >セッション - >フラッシュ()を持っています;'レイアウト(またはビュー)で? –
@mattb echo $ this-> Session-> flash( 'auth');レイアウトに座っている。 – Plastika