Is it righ开发者_开发问答t way that session_start() and session_destroy(); be in the same page?
session_start();
page content
session_destroy();
The point of sessions is to be available across multiple requests. If you destroy a session with session_destroy()
, the session will not be available anymore. So, usually, you will not call session_destroy()
on any page unless you want to completely end it, like in a "logout" functionality.
If you do want to destroy the session, you must call session_start()
to open the session before you can destroy it with session_destroy()
.
精彩评论