我创建了两个应用程序,比方说我的第一个应用程序叫做mastersite,而第二个应用程序叫做childesite。我将childesite项目存储在mastersite项目目录下。子域读取域会话
我在我的apache服务器上创建了虚拟主机,并且目录的文档根指向masterproject目录,假设虚拟主机名是www.mastersite.com。之后,我创建了虚拟主机的子域,假设虚拟主机名的子域是www.childesite.mastersite.com。
虽然www.mastersite.com由浏览器打开,但应用程序会将虚拟数据存储到其会话中。假设我将它命名为dummy_data,并将dummy_data设置为“123”。 dummy_data ='123';
打开www.childesite.mastersite.com时,它将读取mastersite.com域中的dummy_data并将dummy_data输出到浏览器。但www.childesite.mastersite.com是空白的,因为它无法读取域会话。
但是,如果我尝试使用www.mastersite.com/childesite打开childesite,虚拟数据将被打印到浏览器中。
为什么这些事情会发生?
可以帮助 http://stackoverflow.com/questions/348282/php -cookie-domain-subdomain-control。 或此链接 http://content.websitegear.com/article/subdomain_tips.htm – 2010-01-12 14:50:24