如何限制特定域中的会话?
我有一个部署在 http://myserver/app1 的 Web 应用程序,我还有另一个应用程序实例访问 http://myserver/app2。
基本上,当我登录app1时,我也会登录app2as。显然,应用程序的每个实例都是相同的。
将应用程序的每个实例限制为唯一且完全独立的最佳方法是什么,以便分别对每个实例应用授权和身份验证?
I have a web application that's deployed at http://myserver/app1, I've also got another instance of the application that's accessed at http://myserver/app2.
Basically, when I log into app1, I am also logged into app2as. Obviously each instance of the application is identical.
What would be the best way of restricting each instance of the application to be unique and completely independent, so authorization and authentication was applied on each instance individually?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以更改 cookie 用于第二个应用程序的名称。如果使用 $_SESSION 只需使用 session_name()。你需要先运行它。
You could change the name that the cookie uses for the second app. If it's using $_SESSION just use session_name(). You're going to need to run that before anything else.
您可以使用不同的会话名称,但使用
session_set_cookie_params()
You could use a different session name, but it would be more appropriate to change the domain or path on the session cookie using
session_set_cookie_params()