开发者

CakePHP Subdomain Cookies

开发者 https://www.devze.com 2023-04-10 17:03 出处:网络
I\'m 开发者_如何学JAVAtrying to make a user session in CakePHP persist across all subdomains. All subdomains point back to the same Cake app and are routed to their respective controllers. for example

I'm 开发者_如何学JAVAtrying to make a user session in CakePHP persist across all subdomains. All subdomains point back to the same Cake app and are routed to their respective controllers. for example, profile.example.com points to example.com/players/view. But for some reason, i cannot get the sessions to persist. I tried using the Cookie component, but id did absolutely nothing. Then i tried using ini_set in my bootstrap and at least got the correct cookie. however, it creates a seperate cookie when accessing the different subdomain. How exactly am I supposed to do this?


putting this in my bootstrap fixed it:

ini_set('session.cookie_domain', '.domain.com'); 

Don't know why it didn't work before, but it ended up working. Maybe clearing the cache did it.


http://book.cakephp.org/view/1281/Controller-Setup

check the key $domain

0

精彩评论

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

关注公众号