I am working in magento community-1.6. I need to clear session or logout the current user at one stage of my site process. How will I do this.?
You need to call logout() function from above class dependency. Call customerLogout() function from above file to programmatically log out a customer from the current session.
You can check any physical file is exist or not at a specific location in Magento directory by Magento\Framework\Filesystem\Driver\File class. You can use Magento 2 native class to check file is exist or not instead of the core PHP method. Call from a template file, echo $block->checkFileExists();
You can simply destroy session to logout the customer. /** @var Magento\Customer\Model\Session; */ $session->destroy(); And than redirect page to login page.
Mage::getSingleton('customer/session')->logout();
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