简体   繁体   中英

Laravel Session Cookie Expiry Changing

I am running into a problem when my Laravel session-cookie changes expiry time each time I refresh and often expires after 2x refreshes.

I think the expected functionality is for it to expire x minutes after you last interacted with the service, but mine seems to work very differently. Let me detail it:

In my Laravel .env file I have

APP_TIMEZONE="Pacific/Auckland"

Accessing PHP via the CLI I get this output with regards to my local time:

php -a
Interactive shell
php > echo date("Y-m-d H:i:s");
2018-12-30 04:08:09
php > echo date_default_timezone_get();
UTC
php > echo date('I');
0

The time given above is out by an hour. I think PHP is misconfigured for daylight savings. My cookie access times are also off by an hour as well, because of this I assume.

  1. Login (Success)

    • Expires on: Mon, 31 Dec 2018 03:53:21 GMT
    • Last accessed on: Sun, 30 Dec 2018 03:53:21 GMT
  2. Refresh #1 (Success)

    • Expires on: Sun, 30 Dec 2018 05:53:31 GMT
    • Last accessed on: Sun, 30 Dec 05:53:31 GMT
  3. Refresh #2 (Logged Out)

    • Expires on: Sun, 30 Dec 2018 05:53:39 GMT
    • Last accessed on: Sun, 30 Dec 2018 05:53:39 GMT

Here's a video of it occuring: https://youtu.be/ssPAn5aE0ME

I would have expected that my Expires on value would have been bumped forward to 24 hours ahead of when I last accessed the application (that is what my session timeout is set to).

Any help would be appreciated!

我通过反复检查.env文件和PHP ini文件中的时区设置来解决此问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM