我創建了兩個應用程序,比方說我的第一個應用程序叫做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