Reputation: 31548
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
Upvotes: 28
Views: 49671
Reputation: 5877
To clear all session data (attributes) you should use clear. Example:
$session->clear();
Please also see Symfony session attributes documentation.
Upvotes: 11
Reputation: 9080
Visit this link
http://api.symfony.com/master/Symfony/Component/HttpFoundation/Session/Session.html#remove%28%29
$session->remove('user_id')
;
Upvotes: 50