how to logout from a php session - session_destroy doesn't seem to be enough

后端 未结 6 782
囚心锁ツ
囚心锁ツ 2021-01-15 19:01

I\'m trying to learn PHP and using sessions. I seen examples about using session_destroy on logout, but I see this in the php documentation:

In order

6条回答
  •  萌比男神i
    2021-01-15 19:32

    if you are using session id. then you can do this

    session_start();
    unset($_SESSION['id']);
    session_destroy();
    

    for cookies you can set the cookie time to some past date.

提交回复
热议问题