开发者

Correct way to start as sessions when two same apps work on the same domain

开发者 https://www.devze.com 2023-04-02 04:55 出处:网络
I have two identical apps working on the same domain, on开发者_开发百科e at root and the other one a folder. Eg.

I have two identical apps working on the same domain, on开发者_开发百科e at root and the other one a folder. Eg.

myapp.com
myapp.com/secondapp

What is the correct way to start a session in the app so the session data does not get interleaved? Currently I have just

  if (!session_id())
    session_start();

and when I log into one app, the session gets transferred when I log into the other one.


You just need to set a unique session name in at least one location:

session_name('globalsession');
session_start();

session_name('subfoldersession');
session_start();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号