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

后端 未结 6 732
囚心锁ツ
囚心锁ツ 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条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-15 19:14

    At the first: use the unset() function. So if you have a $_SESSION['user_id'], and you wanne destroy it: unset($_SESSION['user_id'])

    You can also use the unset() for cookies or other vars

    Second: can we have some code?

提交回复
热议问题