Accessing a Symfony2 session from another php file?

I want to access symfony session data from another php page based in a web directory.

I defined:

$this->getRequest()->getSession()->set('school', 'abc'); 

And I want to get ("school") in another php-page that existed in the web directory (and not in the controller). I searched Google for hours and tried many alternatives, but could not succeed.

+4
source share
1 answer

I solved this problem with this solution:

In config.yml:

 framework: session: save_path: ~ 

Then I ran session_start(); into a simple php script.

And access through:

 $_SESSION['_sf2_attributes']['my_value']; 

Now this is normal.

+3
source

All Articles