简体   繁体   English

PdoSessionHandler的Symfony2问题

[英]Symfony2 problems with PdoSessionHandler

I'm having some problems in my Symfony2 project to set up the parametes in config.yml to be able to use PdoSessionHandler correctly. 我在Symfony2项目中遇到一些问题,无法在config.yml中设置参数,以便能够正确使用PdoSessionHandler。 The version of Symfony that Im using is 2.3.9 我使用的Symfony版本是2.3.9

What Im trying to do is to store sessions in the database using the PdoSessionHandler. 我试图做的是使用PdoSessionHandler将会话存储在数据库中。

I've followed the cookbook, but I'm having the following error in my config.yml 我遵循了食谱,但是在config.yml中出现以下错误

There is no extension able to load the configuration for "session.handler.pdo" 没有扩展能够加载“ session.handler.pdo”的配置

Is there another change or config that should be done to have effect? 要进行其他更改或配置才能生效?

Thanks... 谢谢...

You haven't added session.handler.pdo as a service definition (under services: ) but as a configuration-definition/root-node in your config.yml . 您尚未将session.handler.pdo添加为服务定义(在services: ),而是将其添加为config.yml的配置定义/根节点。

That's why symfony can't find an extension for loading that non-existant configuration. 这就是为什么symfony找不到用于加载该不存在的配置的扩展名的原因。

This will work: 这将起作用:

services:
    session.handler.pdo: 
        class:     Symfony\Component\HttpFoundation\Session\Storage\Handler
        # ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM