PHP Sessions across sub domains

前端 未结 17 1662
慢半拍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:27

    I solved it like this

    ini_set('session.cookie_domain', '.testdomain.example');
    session_start();
    

    Because I was working on localhost

    ini_set('session.cookie_domain', '.localhost');
    

    wasn't working, it sees .localhost as the toplevel instead of .com/.local/... (I suspect)

提交回复
热议问题