简体   繁体   English

$_SESSION 在 symfony2.1 中不起作用

[英]$_SESSION not working in symfony2.1

I have upgraded the symfony2.0 project to symfony2.1.3.我已经将 symfony2.0 项目升级到了 symfony2.1.3。 All the module working same as old version, but the $_SESSION is not working in new version.所有模块的工作方式与旧版本相同,但$_SESSION在新版本中不起作用。

How can I get all data of the session in my Symfony app?如何在我的 Symfony 应用程序中获取会话的所有数据? I would like the session to be shared between the 2 applications.我希望在 2 个应用程序之间共享会话。

use Symfony\Component\HttpFoundation\Session\Session;

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

$data = $session->all();

The $data variable will now contain the session data. $data变量现在将包含会话数据。

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

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