允许PHP的会议进行到子域 [英] Allow php sessions to carry over to subdomains

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

问题描述

我使用PHP会话(不是饼干,除了会话cookie)的所有用户数据,当用户进入他们的个人资料user.mydomain.com他们立即登出,直到然后删除的子站点。

I use php sessions (not cookies, except for session id cookie) for all user data, and when a user goes to their profile user.mydomain.com they are immediately "logged out" untill then remove the subdomain.

有没有一种方法,只要能够接受来自所有域的会话作为其* .mydomain.com来

Is there a way to accept sessions from all domains as long as its *.mydomain.com

推荐答案

下面3个选项。

这将在php.ini:

Place this in your php.ini:

session.cookie_domain = ".example.com"

在你的.htaccess:

In your .htaccess:

php_value session.cookie_domain .example.com

由于在脚本的第一件事:

As the first thing in your script:

ini_set('session.cookie_domain', '.example.com' );

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

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