开发者

What is difference between page with session_destroy() and without

开发者 https://www.devze.com 2023-02-19 23:55 出处:网络
Is it righ开发者_开发问答t way that session_start() and session_destroy(); be in the same page?

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().

0

精彩评论

暂无评论...
验证码 换一张
取 消