PHP Sessions with disabled cookies, does it work?

前端 未结 9 1833
暖寄归人
暖寄归人 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:28

    You are right, Session cannot work without cookies. To illustrate this try doing the following actions.

    1. Login To Gmail.
    2. After login disabled the cookies.
    3. Refresh the page.

    You will be redirected to the login page again as the server cannot identify the session.

    1. Now again enable the cookies.
    2. Refresh the page. (Note: Don't click on login button).
    3. You will be automatically redirected to the Gmail inbox.

    Hence, we can say without cookies session will not work.

    Also, If you are trying to login into the gmail( taking as example you can take any website) with diabled cookies then it will message as "Your browser has cookies disabled. Make sure your cookies are enabled and try again."

提交回复
热议问题