proper way to logout from a session in PHP

后端 未结 4 1984
误落风尘
误落风尘 2020-11-28 09:00

I have read many php tutorials for logout scripts, i am wondering what could be the proper way to logout from a session!

Script 1



        
4条回答
  •  忘掉有多难
    2020-11-28 09:52

    Session_unset(); only destroys the session variables. To end the session there is another function called session_destroy(); which also destroys the session .

    update :

    In order to kill the session altogether, like to log the user out, the session id must also be unset. If a cookie is used to propagate the session id (default behavior), then the session cookie must be deleted. setcookie() may be used for that

提交回复
热议问题