从域到子域的会话 [英] Session from Domain to Subdomain

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

问题描述

嘿伙计们,我的域名
我设置

Hey guys,
on my domain I set

$_SESSION['name'] = $rows['name'];



那么现在我如何将会话传送到子域?我发现谷歌没有帮助/工作条目,我没有计划如何做到这一点:S



编辑:

域名和子域位于同一服务器上,例如:www.just.com和test.just.com


So now how can I transmitt the Session to the subdomain? I found no helping/working entry on google and I have no plan how to do this :S


The domain and the subdomain are on the same server, for example: www.just.com and test.just.com

推荐答案

_SESSION [ ' name'] =
_SESSION['name'] =


rows [' name'];
rows['name'];



现在我如何将会话传送到子域?我发现谷歌没有帮助/工作条目,我没有计划如何做到这一点:S



编辑:

域名和子域位于同一服务器上,例如:www.just.com和test.just.com


So now how can I transmitt the Session to the subdomain? I found no helping/working entry on google and I have no plan how to do this :S


The domain and the subdomain are on the same server, for example: www.just.com and test.just.com


会话本身与您的域名无关。

)会话由具有会话ID的cookie识别(或在URL中传递)。

2)cookie与域名有关:您可以在子域中访问cookie ,但为此您可能需要修改php ini设置(session.cookie_domain)

3)现在让我们假设子域托管在同一台服务器上,你就不要不需要在主机之间共享会话数据 - 您仍然必须小心不要覆盖收集的会话。



阅读这些内容以获取更多详细信息,您将明白这一点:

http://stackoverflow.com/questions/6318492/sharing-session-over-subdomains-in-php [ ^ ]

http://stackoverflow.com/questions/644920/allow-php-会话转移到子域 [ ^ ]
The session itself has little to do with your domains.
1) The session is identified by a cookie with the session id (or passed in the url).
2) The cookie has to do with domains: you can make a cookie to be accessible in subdomains, but for that you will probably need to modify a php ini setting (session.cookie_domain)
3) And now let''s suppose that the subdomain is hosted on the same server, and you don''t need to share session data between hosts - you still have to be careful not to override gathered session.

Read these for more details, and you will get the point:
http://stackoverflow.com/questions/6318492/sharing-session-over-subdomains-in-php[^]
http://stackoverflow.com/questions/644920/allow-php-sessions-to-carry-over-to-subdomains[^]


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

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