Allow php sessions to carry over to subdomains

前端 未结 10 1117
清歌不尽
清歌不尽 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:56

            if(isset($_COOKIE['session_id']))
                session_id($_COOKIE['session_id']);
            Zend_Session::start(); //or session_start();
            if(!isset($_COOKIE['session_id']))
                setcookie('session_id', session_id(), 0, '/', '.yourdomain.com');
    

    security be damned, if you are as frustrated with incomplete or bad answers as I am, this is your savior. It just works.

提交回复
热议问题