【发布时间】:2015-11-17 23:11:20
【问题描述】:
我正在使用基于 symfony2 (2.5) 的应用程序遇到一个非常奇怪的问题。
长话短说: 在 config.yml 文件中我有这个:
framework:
...
session:
name: "a_given_name"
# THE FOLLOWING LINE CAUSES THE PROBLEM
handler_id: session.handler.native_file
save_path: "%kernel.root_dir%/sessions"
cookie_lifetime: 2629744 #1 month
gc_maxlifetime: 2629744 #1 month
...
会话不起作用! 我检查了所有内容,系统创建了文件,但这些文件始终为空。
将 config.yml 中的“handler_id”条目更改为:“~”一切正常。
framework:
...
session:
# CHANGING TO THE FOLLOWING -> IT WORKS
handler_id: ~
...
但是,正如文档中所述,“session.handler.native_file”是默认的处理程序......所以它应该可以正常工作......
有什么帮助吗? 非常感谢...
【问题讨论】:
-
运行
php app/console debug:container session.handler.native_file -
我已经运行了这个命令
php app/console container:debug session.handler.native_file,这是我收到的:[Symfony\Component\DependencyInjection\Exception\InvalidArgumentException] The service definition "session.handler.native_file" does not exist.事实上这个类存在并且它被使用了......我已经调试过了......跨度>