Article From:https://segmentfault.com/q/1010000010841194
Question:

Development environment:

  1. thinkphp5.0.10

  2. WeChat public platform (service number)

Problem description

  1. The simple point is that session will not fail, and one or two days and three or four days will not fail.

  2. I need to quit the public address once.

Solutions

  1. It is awkward to set session failure time in thinkPHP, result – useless, and then do not prompt the error.

A unified response to an existing answer

In theory, WeChat’s built-in browser is really a WebView, which is equivalent to a browser. In theory, the original session will fail, but I’m not going to fail.

The above point is actually passive, and we take the initiative to solve it by setting session to failure time. My system has webpc backstage, and WeChat public address to the front desk. After setting session to failure time, the webpc port is normal.The session failure time is processed, but the page in WeChat public address is still invalid.

This question should not be a problem in theory, but a practical problem, just as if you have been able to meet this situation or to help me analyze where it may be.

Platform: centos7.0 lnmp.org installation environment, thinkphp5.0.10 WeChat public address service No.

Answer 0:

This audit period is too long. I’ll do it manually.

Answer 1:

sessionFailure is usually related to server settings.
“What is the meaning of this operation? Is it close to WeChat browsers? I know it needs to end the WeChat process.

sessionHave a configurationcookie:{expires:'session'} You can set off the browser (which means shutting down the entire browser or ending the WeChat process).sessionTo fail.

You can find itthinkphpThe corresponding configuration.

Answer 2:

The client browsing web page is implemented by WebView. Each time it opens, it is equivalent to the browser’s exit.
so,Either use cookie to set the expiration date, or use token, and then save LocalStorage.

Answer 3:

When you quit logged in
Remove the cookie
However, there is no explicit deletion function for cookie, and the expire of cookie should be set as a overdue time, such as 1 hours ago, which automatically triggers the browser’s deletion mechanism, such as:setcookie('name', 'lisi', 0)You can clear this cookie attribute called name

Answer 4:

I also encounter this problem, WeChat browser session will not fail, unlike PC browser. Unless you quit your micro – signal.

Answer 5:

I also met, session will not fail. Is there any way to manually invalidate these session?

Leave a Reply

Your email address will not be published. Required fields are marked *