【问题标题】:SessionComponent::setFlash会话组件::setFlash
【发布时间】:2014-05-15 15:33:55
【问题描述】:

我正在使用 CakePHP 2。

这是我的控制器。

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 的一个方法。

请帮忙,谢谢。 孔塔。

【问题讨论】:

    标签: cakephp


    【解决方案1】:

    试试这个 ::

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

    【讨论】:

      猜你喜欢
      • 2016-02-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-08
      • 2015-06-15
      • 1970-01-01
      • 2021-10-15
      • 1970-01-01
      相关资源
      最近更新 更多