Like in classic PHP we use the magic variables to start and create sessions, so how to do that in Symfony?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
In your controller, you can access session variables through the user object.
In Symfony2, the syntax is different:
You can also get session variables from Twig, without having to pass the session variable explicitly (it's in the global 'app'):