PHP Sessions with disabled cookies, does it work?

前端 未结 9 1826
暖寄归人
暖寄归人 2020-11-28 03:58

Today I had skype interview for a job as PHP developer, one of the questions asked was about Cookies and PHP Sessions.

The question was, can PHP session be set and r

9条回答
  •  离开以前
    2020-11-28 04:39

    Yes session will work when cookies is disabled. But first apache check php configuration settings. Like:

       --enable-trans-sid
    and
       --enable-track-vars
    

    if these value are set true the session will passed by POST automatically.

    If "--enable-trans-sid" and "--enable-track-vars" values are set to FALSE, we need to pass session id by using the SID constant.

    < a href="index.php?" >Navigate from here< /a >
    

    Need to set php.ini

    ini_set("session.use_cookies", 0);
    ini_set("session.use_trans_sid", 1);
    

提交回复
热议问题