简体   繁体   中英

Unable to destroy session in main domain from subdomain

My domain name domain.com and sub-domain is user.domain.com

If I logged in from domain.com then its working fine. I am getting all the session data in my user.domain.com . While I am logout from user.domain.com my main domain domain.com still logged in. If I refreshed main domain. Again session set in my user.domain.com .

I want to destroy session from all the parent and child domain when click logout from my user.domain.com sub-domain.

Yesterday, I have posted forum in here:

http://www.yiiframework.com/forum/index.php/topic/76155-logout-issue-in-subdomain

NB: I would like to know this in core php not Yii framework. If anyone also know in Yii you can post answer here.

You simply need to destroy session from both domain. domain.com and user.domain.com are two different entities.

If that doesn't work, try unsetting the keys before destroying the session.

For example: unset($_SESSION['id']) , The id will be removed from the $_SESSION .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM