当前位置: 动力学知识库 > 问答 > 编程问答 >

php - my subdomain share same session with master domain, how can I disable it?

问题描述:

I have a submain.example.com and example.com . When I set a session in example.com . I can print it out in submain.example.com. But I don't want it. What can I do to disable it?

Thank you.

网友答案:

You can define the valid domains for a cookie. In your case use:

ini_set('session.cookie_domain', $_SERVER['SERVER_NAME']);
分享给朋友:
您可能感兴趣的文章:
随机阅读: