Tencent / Tencent/Biny

可以让“session”在关闭浏览器后不被删除吗

Open
#109 15 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
1.7k
Forks
253
PR merge metrics
No merged PRs in 30d

Description

在写用户登录后保持登录的功能,之前用的是
App::$base->session->web_userid =$webUser['uid']
来储存登录的用户信息,
但这个在每次关闭浏览器后重新打开,值就没了,
有想过用cookie来写,但cookie有安全隐患,
有什么办法让session可以不被自动清空吗?

看到 /config/config.php 里面有个
'session' => array(
'save_handler'=>'files', //redis memcache
'maxlifetime' => 60 * 60 * 24 * 7 //过期时间s
),
我在想 ,是不是与save_handler的值有关系

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with config/config.php and inspect the session settings, especially save_handler and maxlifetime. Reproduce the login session behavior across a browser restart, then review the existing comment discussion to determine whether the requested persistence is supported and what security constraints apply. Done means a clear, tested decision or documented behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
authentication
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.