Heim  >  Artikel  >  Backend-Entwicklung  >  不同的项目下获取的session id 是相同的问题

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

WBOY
WBOYOriginal
2016-06-06 20:50:231461Durchsuche

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 ...

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn