开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜