CakePHP 2.0.3 对象上的致命错误 flash()
当我尝试使用错误的控制器时,我收到此消息,并且我发现我没有从 cakephp 中得到正确的错误,我在 2.0.0 中得到了正确的错误:
现在,当我尝试使用错误的控制器时,我仅收到此消息:
Fatal error: Call to a member function Flash() on a non-object in
/srv/www/htdocs/web843/HTML/schaetzmal/lib/Cake/View/Layouts/default.ctp
on line 44
cakephp 2.0.3 是否有错误,或者我是否错过了要安装的东西来让这个工作或我可以做的其他事情?
I've get this message when I tried to use a wrong controller and I figured it out that I'm not getting the right Error from cakephp I've got in 2.0.0 the right one:
Now when I try a wrong controller I get only this message:
Fatal error: Call to a member function Flash() on a non-object in
/srv/www/htdocs/web843/HTML/schaetzmal/lib/Cake/View/Layouts/default.ctp
on line 44
Does cakephp 2.0.3 have an bug or do I miss something to install to let work this or something else what I can do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
确保您已将会话助手添加到公共
$helpers
数组中。或者您可以将其添加到全局AppController,以便会话助手可供所有控制器使用。
Make sure you've added the Session helper to your public
$helpers
array.Or you could add it to a global AppController so that the Session helper is available to all controllers.
我发现了一些问题,为什么我的 AppController 无法工作。
就像mensch说的那样,我必须在我的
AppController
中使用Session来实现全局,但这不是解决方案,因为cakephp的书在“全局 AppController"但它没有发生。因为我在公共变量
$helpers
中覆盖了它。因此,我采用给定的父级并将其与它合并:
$this->helpers = array('Form','Html','Js');
进行合并并且工作正常。谢谢你们,
谢谢你们帮助mensch,这就是我需要的黑客
I found some problems why my AppController didn´t work.
Like mensch says i have to use Session in my
AppController
for global but that´s not the solution because the book of cakephp says in "a global AppController"but it´s not happening. Because i overwrite it in the public variable
$helpers
.therfore i take the parent given one and merge it with it:
the
$this->helpers = array('Form','Html','Js');
do the merge and it works fine.thank you guys
thanks for helping mensch that was the hack i needed