Add the following code to each second-level domain name siteentry file index.php
define('DOMAIN','cdfanfan.com'); /// cdfanfan.com is changed to the actual root domain name
/ /The following two lines are for subdomain sharing SESSION. Note that DOMAIN needs to be changed to the actual root domain name
ini_set('session.cookie_path', '/');
ini_set('session.cookie_domain', DOMAIN);
The session storage location of each second-level domain name site is changed to shared storage: for example, mysql
Add 'SESSION_TYPE'=>'Db',
mysql to the table ocenter_session in the configuration file of each second-level domain name site, table The prefix ocenter_ needs to be modified according to the environment
CREATE TABLE `ocenter_session` (
`session_id` varchar(255) NOT NULL,
`session_expire` int(11) NOT NULL,
`ses sion_data` blob,
UNIQUE KEY `session_id` (`session_id`)
)
The above introduces the thinkphp second-level domain name site session sharing (single sign-on), including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.