如何为两个www编写会话.和我域的非www版本? [英] How to write session for both www. and non-www version of my domain?
本文介绍了如何为两个www编写会话.和我域的非www版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在mydomain.com/login.php
上编写会话,我相信无法在www.mydomain.com
中进行访问.是对的吗?
I'm writing session on mydomain.com/login.php
I believe this can't be accessed in www.mydomain.com
. Is that right?
如何写入$ _SESSION,以便可以从两个www都访问它.和我域的非www版本?
How can I write to $_SESSION so I can access it from both the www. and non-www version of my domain?
推荐答案
看一下 session_set_cookie_params
它说明了在域中设置.
还将允许访问子域,
have a look at session_set_cookie_params
it explains setting .
in the domain will allows for access to subdomains as well,
Cookie domain, for example 'www.php.net'. To make cookies visible on all
subdomains then the domain must be prefixed with a dot like '.php.net'.
miki有个例子
http://www.php.净/手动/zh/function.session-set-cookie-params.php#94961
这篇关于如何为两个www编写会话.和我域的非www版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文