CakePHP Subdomain Cookies
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
精彩评论