PHP Sessions across sub domains

前端 未结 17 1813
慢半拍i
慢半拍i 2020-11-22 05:59

I am trying to set up the following:

auth.example.com
sub1.example.com
sub2.example.com

If the user visits sub1.example.com or

17条回答
  •  感动是毒
    2020-11-22 06:14

    Use this , it works:

    ini_set('session.cookie_domain', 
        substr($_SERVER['SERVER_NAME'],strpos($_SERVER['SERVER_NAME'],"."),100));
    

提交回复
热议问题