无法在产品环境中使用Flash方法 [英] Can't use flash method in prod environment
问题描述
我正在将symfony 1.4的setFlash和hasFlash方法与WAMP 2.0一起使用
I'm using the setFlash and hasFlash methods of symfony 1.4 with WAMP 2.0
在本地使用我的frontend_dev应用程序,一切正常.
但是在生产环境中,我的测试$this->forward404Unless($user->hasFlash('resultsArray'));
失败.
Locally with my frontend_dev app, all work fine.
But in production environment, my test $this->forward404Unless($user->hasFlash('resultsArray'));
fails.
我认为默认情况下启用了flash方法.我该怎么做才能使其正常工作?
I thought that the flash methods where enabled by default. What can I do to make it works please ?
我发现了一条有趣的错误消息.
Edit : I found an interesting error message.
这是我的filters.yml文件
Here is my filters.yml file
# You can find more information about this file on the symfony website:
# http://www.symfony-project.org/reference/1_4/en/12-Filters
rendering: ~
security: ~
# insert your own filters here
cache: ~
flash: ~
execution: ~
在frontend_prod.log中,我有:
In the frontend_prod.log, I have :
3月16日05:57:42 symfony [info] {sfPatternRouting}使用参数数组('module'=>'main','action'=>'index',)匹配/的路由首页"(/)
3月16日05:57:42 symfony [err] {sfParseException}配置文件"D:\ wamp \ bin \ php \ symfony \ symfony14 \ lib/config/config/filters.yml"指定类别"flash",缺少类密钥.
Mar 16 05:57:42 symfony [info] {sfPatternRouting} Match route "homepage" (/) for / with parameters array ( 'module' => 'main', 'action' => 'index',)
Mar 16 05:57:42 symfony [err] {sfParseException} Configuration file "D:\wamp\bin\php\symfony\symfony14\lib/config/config/filters.yml" specifies category "flash" with missing class key.
推荐答案
您是否在重定向/转发上下文中调用 executeShowResult 操作?闪光灯的寿命有限,并且在下一个请求后将消失.显然, resultsArray 已被清除.
Do you call the executeShowResult action in a redirect/forward context? The flash has a limited lifetime and it will disappear after the very next request. Clearly the resultsArray has been flushed out.
这篇关于无法在产品环境中使用Flash方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!