php - Subdomain Session Issue -


I am trying to access session data on multiple wildcard subdomains. I set the session using the following:

  & lt ;? Php session_name ("session"); Session_set_cookie_params (0, '/', '.example.com'); Session_start (); $ _SESSION ['MID'] = 1 9 2; ? & Gt;   

I set the above session to sub1.example.com . I then go to sub2.example.com and I use the following code to use the session:

  & lt ;? Php session_name ("session"); Session_set_cookie_params (0, '/', '.example.com'); Session_start (); Print_r ($ _ session); ? & Gt;   

But the session is empty. What am I missing?

You tried to use:

  session_regenerate_id (true) );             P>

Comments