Facebook PHP页面选项卡应用程序 - $ _SESSION在用户关闭浏览器窗口时不会持续 [英] Facebook PHP page tab app - $_SESSION does not sustain when a user closes their browser window

查看:93
本文介绍了Facebook PHP页面选项卡应用程序 - $ _SESSION在用户关闭浏览器窗口时不会持续的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个页面标签应用程序,是一个类似门口的比赛。

I have a page tab app that is a contest with a like gate.

用户喜欢一个页面,提供他们的电子邮件地址并点击提交进入比赛

A user likes a page, provides their email address and hits submit to enter the contest.

输入后,我设置一个会话变量$ _SESSION ['entered'] ='1';或类似的东西

After they enter, I set a session variable $_SESSION['entered'] = '1'; or something similar

输入后,我会在页面上显示更多信息(html),并删除电子邮件表单。

Once they enter, I show more information on the page(html) and remove the email form.

问题:如果用户停留在页面上,刷新一百万次(在同一浏览器窗口中),会话变量保留,我可以告诉用户输入并显示正确的信息。

如果用户关闭窗口,稍后再回到新窗口中等等。我丢失了会话信息,并显示了用户再次输入表单(虽然已经进入比赛)

如果他们离开,我如何维护页面应用中的用户的会话并回来?

How do I sustain the session for the user in the page app if they leave and come back?

推荐答案

您可以使用 cookie 。会话将在退出浏览器后关闭,但Cookie将持续到达他们的到期日。

You could use a cookie instead. Sessions will close out on exiting the browser, but cookies will last until the expiration date is reached on them.

您还可以设置它们必须登录,在他们的用户中,您是否设置了是否已经进入比赛,并相应地调整页面。 (只是一个想法...)

You could also set it up that they have to log in, and in their user, you set whether they have entered the contest or not and adjust the page accordingly. (just an idea...)

这篇关于Facebook PHP页面选项卡应用程序 - $ _SESSION在用户关闭浏览器窗口时不会持续的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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