开发者

CakePHP not showing flash() messages?

I am writing a CakePHP app but it doesn't seem to be showing flash()开发者_运维技巧 messages on any of the pages.

I am using $this->Session->setFlash(); to set flash() messages and using $this->Session->flash() in my default template, as well as $this->Session->flash('auth') on the login and registration pages but they don't show the validation errors etc.


In your views & layouts, you're looking for the session helper, not the session component that you're trying to use. In controllers/components, you use the session component and reference it as $this->Session. In your layouts and views, you use the session helper and reference it simply as $session. e.g. $session->flash();

More about the session helper can be found in the documentation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜