同一域,不同文件夹的PHP会话 [英] Same domain, different folder PHP session

查看:67
本文介绍了同一域,不同文件夹的PHP会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想根据用户所在的文件夹设置不同的会话ID.

I want to set a different session ID depending on what folder a user is in.

例如,我有一个域 https://example.com ,其文件夹为/app1,/app2,等等,然后在每个应用程序文件夹中包含多个文件.我想设置一个会话ID以与app1中的所有文件一起使用,并设置另一个会话ID以在app2中使用.

For example, I have the domain https://example.com which has the folders /app1, /app2, etc. and then multiple files inside each app folder. I would like to set one session ID to be used with all files in app1 and a different session ID to be used in app2.

可以做到吗?

推荐答案

使用 session_set_cookie_params .当然在session_start之前.

这篇关于同一域,不同文件夹的PHP会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆