开发者

Carrying Sessions To Subdomain [duplicate]

开发者 https://www.devze.com 2023-04-13 06:44 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: PHP SESSION lost on SUBDOMAIN
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

PHP SESSION lost on SUBDOMAIN

I can't use a session on a subdomain @ panel.cyberbat.co.uk

But cyberbat.co.uk sessions work fine, the session is created on the main domain but can't be used on the subdomain, could anyone help me?

FIXED: I used a Coookie i开发者_StackOverflownstead of a session.


You could use ini_set('session.cookie_domain', '.cyberbat.co.uk'); (note the dot in front of the value), that way the session cookie will work on all subdomains.

Or, if you have your own cookies, you can also specify the domain in setcookie:

setcookie('mycookie', $a_value, time() + 3600, '/', '.cyberbat.co.uk');
0

精彩评论

暂无评论...
验证码 换一张
取 消