会话未设置,还是session_destroy? [英] Session unset, or session_destroy?

查看:94
本文介绍了会话未设置,还是session_destroy?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
session_unset()和有什么区别和PHP中的session_destroy()?

Possible Duplicate:
What is the difference between session_unset() and session_destroy() in PHP?

最安全的方法是什么,如果未设置会话,则下次访问该会话而不是重新创建该会话时,加载时间会更好吗?

What is the best for security, and if the session is unset are load times better the next time the session has to accessed rather than recreated?

推荐答案

取消设置将破坏特定的会话变量,而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.

这篇关于会话未设置,还是session_destroy?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆