Questions about the PHP session changing every time it is refreshed
This morning found that the session saved problems, can not pass the session. Read PHP files are not any exception, and no error.
Found on the Internet some articles, said whether the php.ini file inside the Session.save_path is not set up, and then looked at, and did not find any problem, the path is right. Find the directory to save the session file, found that each refresh will generate a new session file, and then try to print session_id () , if so, each refresh will update session_id ().
Then continue to look for more information on the network, some people say it is a cookie problem, because session_id is also carried through the cookie, I try to use the command to print out the value of the cookie var_dump ($_cookie), Finding that the returned value is Array (0) {} does not have anything, which proves that there is a problem with the cookie.
Follow the whole idea to find, and finally found that the session before the cross-domain change the php.ini inside the session.cookie_domain settings, as follows
Session.cookie_domain = ". Zssd.mobi"
Here is the setting of cookies can only be in the top-level domain name Zssd.mobi, the purpose is to solve cross-domain problems, but other domain names have problems (about multiple domain names to implement the session cross-domain may need to use other methods to solve), as long as the Session.cookie_ Domain set to empty will be able to use sesssion_id, the specific changes are as follows
Session.cookie_domain =
Then restart Apache, problem solved.