CakePHP setFlash()奇怪的问题 [英] CakePHP setFlash() weird problem

查看:85
本文介绍了CakePHP setFlash()奇怪的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想 $ this-> Session-> setFlash('text'); $ this-> redirect('page'); ,但不显示该消息。
我已经包括了Session组件和Helper,以及我的布局中的 $ this-> Session-> setFlash()。但是,重定向后,会话不包含任何消息。如果我不重定向,显示消息。

I want to $this->Session->setFlash('text'); $this->redirect('page'); but the message is not displayed. I have included both the Session Component and Helper, and the $this->Session->setFlash() in my layout. However, after the redirect, the session doesn't contain any message. If I don't redirect, the message is shown.

所以我的问题是,为什么不重定向后保存的闪存消息?

So my question is, why isn't the flash message preserved after a redirect? It should be, and this how I've done before, but...it doesn't work now.

感谢您的帮助!

这是我的控制器代码:

if(!$this->Test->__test_possible()){
        $this->Session->setFlash(__('Insufficient data to create test.', true));
        $this->redirect(array('action' => 'index'));
    }

... my layout ...(the cake default.ctp)

...my layout...(the cake default.ctp)

<?php echo $this->Session->flash(); ?>

与AppController:

and the AppController:

var $helpers = array('Html', 'Form', 'Session', 'Facebook.Facebook');
var $components = array('Session', 'Auth', 'Facebook.Connect');


推荐答案

:write('Session.cookie','Capitalize.me');在core.php和似乎他不喜欢的名称中的点...现在一切工作正常。这是令人沮丧,真的。感谢您的帮助:)

Oh darn...I've put Configure::write('Session.cookie', 'Capitalize.me'); in the core.php and it seems he didn't like the dot in the name...now everything works fine. It's frustrating, really. Thanks for your help :)

这篇关于CakePHP setFlash()奇怪的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆