通过 get 传递的 SID 值

发布于 2024-10-08 11:04:51 字数 466 浏览 0 评论 0原文

我试图通过 get (url) 而不是通过 cookie 传递会话 id 的值。 我的 php.ini 配置是:

session.use_cookies = on session.use_only_cookies = 关闭 session.use_trans_sid = on

通常(总是)cookie 在用户的浏览器中处于启用状态,因此如果我尝试通过 url 传递 sid: www.site.com/?phpsessid=abc 它不起作用,因为常量 SID (http://www.php.net/manual/en/session.idpassing.php) 保持为空,并且会话与 $_COOKIE['PHPSESSID'] 一起工作。

如果手动禁用 cookie,则会话将使用 SID。

我的问题是:我可以通过启用 cookie 的 get 使用 SID 吗?也许有一些我不知道的 php.ini 配置......

谢谢:)

I'm trying to pass the value of session id via get (url) and not via cookies.
My configuration of php.ini is:

session.use_cookies = on
session.use_only_cookies = off
session.use_trans_sid = on

Normally (always) the cookie are ENABLED in the user's browser, so if i try to pass the sid via url:
www.site.com/?phpsessid=abc
it doesn't work, because the constant SID (http://www.php.net/manual/en/session.idpassing.php) remain empty and the session work with $_COOKIE['PHPSESSID'].

If the cookie are manually DISABLED the session work with SID.

My question is: can i use the SID via get with cookies enabled? Maybe there is some php.ini configurations that i unknow....

thx :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冬天旳寂寞 2024-10-15 11:04:51

它将位于 $_GET$_COOKIES 中。您可以使用 $_REQUEST['PHPSESSID'] 来始终获取它。

但为什么需要它呢?如果您使用会话,则可以在 $_SESSION 中传递数据,而不必担心会话 ID。

It will be in $_GET or $_COOKIES. You could use $_REQUEST['PHPSESSID'] to always get it.

But why do you need it? If you are using sessions, you pass your data around in in $_SESSION, and don't worry about the session id.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文