dtn43447 2010-07-21 17:55
浏览 24

使会话/ cookie无限期

I am using a login system that sets the session variables / cookies below. Chrome, which awesomely lets you look at your cookies without too much trouble, apparently labels this as a PHPSESSID that expire "When I close my broswer." Sure enough, when I log in, shut down the browser, and then open up a new browser session, I am no longer logged in.

How could I make it so the user stays logged in whether or not the browser is closed? I would like to make it so the user stays logged in (permanently, if possible) unless a deliberate logout is done.

Thanks in advance,

John

$_SESSION['loginid'] = $row['loginid'];

$_SESSION['username'] = $u;    
  • 写回答

3条回答 默认 最新

  • duanniling0018 2010-07-21 17:58
    关注

    You just need to set an expiration date in the future on the session cookie.

    评论

报告相同问题?

悬赏问题

  • ¥20 易康econgnition精度验证
  • ¥15 线程问题判断多次进入
  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致