2015-08-20 06:34
浏览 65


I have the following issue. I am building a PHP + jQuery mobile website and I want to maintain the PHP session. The problem here is that when I close the browser App (Samsung Galaxy S4/S5 or Google Chrome on Android) and I leave the phone for say, ten minutes, and then reopen the browser, the whole session appears to be destroyed and I have to log in again.

I tried to increase the cookie lifetime like this:

ini_set('session.cookie_lifetime', 60 * 60 * 24);
ini_set('session.gc-maxlifetime', 60 * 60 * 24);

But this does not solve it. I think it is because the browser app purges the session data after some time of inactivity.

Note that I do not want to use "remember me" functionality, I just want to use the PHP session ID.

What would be the correct way to solve this? I have looked at local storage but it seems strange the browser App purges the entire session and I am looking for the simplest solution.

图片转代码服务由CSDN问答提供 功能建议

我有以下问题。 我正在构建一个PHP + jQuery移动网站,我想维护PHP会话。 这里的问题是,当我关闭浏览器应用程序(Android上的三星Galaxy S4 / S5或谷歌浏览器)并且我离开手机说十分钟,然后重新打开浏览器时,整个会话似乎被破坏了我 必须再次登录。</ p>

我试图像这样增加cookie的生命周期:</ p>

  ini_set('session.cookie_lifetime',60  * 60 * 24); 
ini_set('session.gc-maxlifetime',60 * 60 * 24); 
 </ code> </ pre> 

但这不是 解决这个问题。 我认为这是因为浏览器应用程序在一段时间不活动后清除会话数据。</ p>

请注意,我不想使用“记住我”功能,我只想使用PHP 会话ID。 </ p>

解决这个问题的正确方法是什么? 我查看了本地存储,但浏览器App清除整个会话似乎很奇怪,我正在寻找最简单的解决方案。</ p> </ div>

2条回答 默认 最新

相关推荐 更多相似问题