Because passport.xxx.com and soft.xxx.com are two second-level subdomains of xxx.com, when both are in a logged-out state, a synchronous login notification is sent via UCenter to implement login. However, in many cases, passport.xxx.com and soft.xxx.com might have one in a logged-in state and the other in a logged-out state. At this point, it is necessary to implement login state synchronization; otherwise, clicking the login link on soft.xxx.com to go to passport.xxx.com will fail because passport is already in a logged-in state and will not allow the login page to open by default, preventing soft from logging in via passport. You have to log out of passport first and then log in again so that both passport and soft can be logged in. The implementation process is as follows:
Configure the following in conf.php on passport.xxx.com:
/* SESSION and COOKIE configuration */
‘SESSION_OPTIONS’ => array(‘domain’=>’.hmwis.com’), // session configuration array, supports parameters such as type name id path expire domain
‘SESSION_PREFIX’ => ‘passport_home’, // session prefix
‘COOKIE_PREFIX’ => ‘passport_home_’, // Cookie prefix to avoid conflicts
Configure the following in conf.php on soft.xxx.com:
/* SESSION and COOKIE configuration */
‘SESSION_OPTIONS’ => array(‘domain’=>’.hmwis.com’), // session configuration array, supports parameters such as type name id path expire domain
‘SESSION_PREFIX’ => ‘soft_home’, // session prefix
‘COOKIE_PREFIX’ => ‘soft_home_’, // Cookie prefix to avoid conflicts
This way, when printing the $_SESSION from passport.xxx.com and soft.xxx.com respectively, they are completely identical:

Finally, implement the synchronous login state processing in soft.xxx.com:

is_login() is the current application’s logged-in user ID; is_passport_login() is the passport’s logged-in user ID; if it is in a logged-out state, the value is 0;
