检测PHP会话是否存在 [英] Detect if PHP session exists

查看:45
本文介绍了检测PHP会话是否存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Facebook现在向用户提供订阅,因此您可以实时获取更改更新.如果我的应用收到更新,我计划将其存储在数据库中.我还想检测他们的会话是否存在.如果可以,那么我也可以在那里更新数据.

Facebook now offer subscriptions to users so you can get realtime updates on changes. If my app receives an update, I plan to store it in the database. I would also like to detect if their session exists. If it does then I could update the data in there too.

我的会话ID是MD5(fb_id + secret),因此我可以轻松地编辑它们的会话.问题是如何检测会话是否存在.

My session IDs are MD5(fb_id + secret) so I could easily edit their session. The question is how can I detect if the session exists.

推荐答案

根据

如果使用$_SESSION(或PHP 4.0.6或更低版本为$HTTP_SESSION_VARS),请使用

If $_SESSION (or $HTTP_SESSION_VARS for PHP 4.0.6 or less) is used, use isset() to check a variable is registered in $_SESSION.

这篇关于检测PHP会话是否存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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