I am setting session variable with this
$session->get('user_id');
I want to clear all session data or single variable. How can i do that
Session variables on the client are read-only. They cannot be modified.
Symfony provides a session object and several utilities that you can use to store information about the user between requests.
Visit this link
http://api.symfony.com/master/Symfony/Component/HttpFoundation/Session/Session.html#remove%28%29
$session->remove('user_id')
;
To clear all session data (attributes) you should use clear. Example:
$session->clear();
Please also see Symfony session attributes documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With