Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

router
.get('/', async function (ctx, next) {

  ctx.state = {
    user: ctx.session.user
  };
  await ctx.render('index', {});
})
.get('/login', async function (ctx, next) {
  if (ctx.session.user) {
    ctx.redirect('/');
  } else {
    await ctx.render('login', {});
  }
})
.post('/login', async function (ctx, next) {
  const {name, password} = ctx.request.body;
  if (name && password) {
    ctx.session.user = name;
    ctx.redirect('/');
  } else {
    ctx.body = '输入用户名和密码';
  }
})
app.use(session({signed: false,maxAge: 100000}, app));

使用koa2写了一个简单的登录,上面session的过期时间是100秒,但奇怪的是在chrome下100后刷新,session是过期了的,需要重新登录。但是在IE11下,一直不过期,什么原因?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
432 views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...