Allow php sessions to carry over to subdomains

前端 未结 10 1118
清歌不尽
清歌不尽 2020-11-22 01:10

I use php sessions (not cookies, except for session id cookie) for all user data, and when a user goes to their profile user.mydomain.com they are immediately \"logged out\"

10条回答
  •  名媛妹妹
    2020-11-22 01:48

    yes. ini_set is working. but remember to destroy all caches and cookies of the browser to see it works.

    1. destroy all caches and cookies of your browser
    2. in your xxx.example.com and yyy.example.com, your php files should start like this.

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

提交回复
热议问题