PHP销毁session,unset() 和 session_destroy()的区别

从PHP.net上了解到关于销毁session的方法:

session_destroy — Destroys all data registered to a session

session_unset — Free all session variables

unset - unset a variable

 unset() 和session_destroy()的区别如下:

Unset will destroy a particular session variable whereas session_destroy() will destroy all the session data for that user.

It really depends on your application as to which one you should use. Just keep the above in mind.

unset($_SESSION['name']); // will delete just the name data

session_destroy(); // will delete ALL data associated with that user.

 

posted on 2012-04-17 23:36  IT技术畅销书  阅读(774)  评论(0编辑  收藏  举报

导航