Home > Backend Development > PHP Tutorial > 不同的项目下获取的session id 是相同的问题

不同的项目下获取的session id 是相同的问题

WBOY
Release: 2016-06-06 20:50:23
Original
1521 people have browsed it

http://localhost:8080/pms/htm/index.php?q=admin/main/index/index

http://localhost:8080/mps/htm/index.php?q=admin/main/index/index

这两个地址对应两个不同的项目,一个是PMS,一个是MPS..

两个项目都有登录功能,登录成功后会把用户信息存到$_SESSION['user']

现在问题是,$SESSION['user']的值会自动被覆盖,查了下cookie里的PHPSESSIDMPS和PHPSESSID_PMS,发现两个的值是一样的...

回复内容:

http://localhost:8080/pms/htm/index.php?q=admin/main/index/index

http://localhost:8080/mps/htm/index.php?q=admin/main/index/index

这两个地址对应两个不同的项目,一个是PMS,一个是MPS..

两个项目都有登录功能,登录成功后会把用户信息存到$_SESSION['user']

现在问题是,$SESSION['user']的值会自动被覆盖,查了下cookie里的PHPSESSIDMPS和PHPSESSID_PMS,发现两个的值是一样的...

session 的作用域默认是同域名 ...

改成路径需要在 session_set_cookie_params 里面设定不同的 path ...

Related labels:
php
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