In fact, it is relatively easy to implement multi-level second-level domain names using cookies or sessions in php at the same time. let's take a look at an example below. the company website has several second-level domain names. the boss requires that no matter which domain name the member goes to, the primary domain name or second-level domain name, the user... in fact, it is relatively easy to implement multi-level second-level domain names using cookies or sessions in php at the same time. let's take a look at an example below.
The company website has several second-level domain names. the boss requires that users log on to the website regardless of the domain name, primary domain name, or second-level domain name that the member has visited, and do not need to log on again. Obviously, single sign-on is required.
Php can be implemented in two ways. the cookie is used to save the session_id. each domain name can access the cookie to obtain the session_id:
1. use the session_set_cookie_params () method:
Session_set_cookie_params (0, $ path, 'phprm. com ');
2. use ini_set or modify php. ini to modify the value of session. cookie_domain:
Ini_set ('session. cookie_domain ', 'phprm. com ')
Permanent address:
Reprint at will ~ Please bring the tutorial URL ^