2012-08-05 25 views
0

我正在使用CakePHP 2.SessionComponent :: setFlash

這是我的控制器。

class GroupsController extends AppController { 
    public $helper = array('Html', 'Form', 'Session'); 
    public function edit($id = null) { 
    if (empty($this->request->data)) { 
     $this->request->data = $this->Group->findByGroupId($id); 
    } else { 
     if($this->Group->save($this->request->data)) { 
     $this->Session.setFlash('Saved!!!'); 
     $this->redirect(array('action' => 'index')); 
     } 
    } 
    } 
} 

當我按下組/編輯/ 1頁上的保存按鈕時,出現錯誤。 「錯誤:調用未定義的函數setFlash()」

幸運的是,我所做的更改是保存到數據庫,我真的不明白,因爲setFlash()是SessionComponent的一個方法。

請幫忙,謝謝。 Kongthap。

回答

1

嘗試這種::

$this->Session->setFlash('Saved!!!'); 
+0

我是很愚蠢的,與其他編程語言混淆。 – Artisan 2012-08-05 17:11:49

相關問題