本地测试环境 sessionid冲突

WBOY
Release: 2016-06-06 20:22:52
Original
1224 people have browsed it

本地测试环境,因为同时有两个项目,两个项目用的同一个php 框架,导致获取的phpsessionid相互覆盖,不知道有没有好的解决办法。

回复内容:

本地测试环境,因为同时有两个项目,两个项目用的同一个php 框架,导致获取的phpsessionid相互覆盖,不知道有没有好的解决办法。

你是指服务端冲突还是客户端。如果是客户端搞2个子域名

手动指定sessionid
在PHP中,你可以设置session_id($yourid).注意这个session_id与session_start的顺序。session_start会检测如果没有指定,则尝试在已经存在的池(我也不知道应不应该叫池)里面取(这就是第二个应用的sessionid为什么和第一个相同的原因了),如果取不到,就"随机"生成一个,所以,你可以在session_start之前告诉php。用你指定的。这样就完美解决你的问题了。

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!