Symfony中的会话管理


Session management in Symfony

我的项目中有两个控制器文件。在第一个CCD_,在LoginProfileAction函数中,我写:

$session = new Session();
$session->start();

然后,我需要访问其他文件中的相同会话对象。既然Symfony不支持$_SESSION变量,我该怎么做?

Symfony Session是本机php$_Session数组的包装器。只要在需要的地方实例化新的$session对象,就可以访问会话数据。

看看:http://symfony.com/doc/current/components/http_foundation/sessions.html

BTW后台符号使用$_SESSION数组。