php session的问题

WBOY
Release: 2016-06-23 13:45:57
Original
1046 people have browsed it

由于用$_SESSION保存的用户名,只能登陆一个账号,不关闭网页登入第二个账号,会把第一个账号覆盖掉,我不想让第二个帐号覆盖第一个,怎么解决这个问题?大神们请详细一点,本人新手,谢谢了。


回复讨论(解决方案)

将session存储名改为动态,如uid
$uid=123;
$sesstion_name='uid_'.$uid;
$_SESSION[$sesstion_name]="test";

那么请问你:张三和李四同时登入当前页,那么如果有一个发帖的动作,那么你说这是张三的还是李四的?

很神奇的需求。

感谢各位大神,问题解决了。在不同的电脑,不同的浏览器,不会出现这个问题!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!