Under normal circumstances, two second-level domain names under the same first-level domain name, such as www.helloweenvsfei.com and images.helloweenvsfei.com, cannot use cookies interchangeably because the domain names of the two are not strictly the same. If you want all second-level domain names under the name helloweenvsfei.com to be able to use this cookie, you need to set the domain parameter of the cookie
Can session be used in two different second-level domain names of the same domain name www.helloweenvsfei.com and images.helloweenvsfei.com
Because I saw that most of the joint logins use cookies and do not use sessions. I don’t know the reason. The premise is that memcash and redis are not used
You can save the session to the memory cache memcache and redis, or you can save it to the database or local file
Does your project allow saving sessions in files or Mysql database?
You should be talking about session sharing. Under the same main domain name, sessions can be shared. For example, the sessinos of a.baidu.com and b.baidu.com can be shared. You can just store the session ID under the root domain name, which means the domain is baidu.com.
You can put
session
存在memcache
或者Redis
inMemcache can be distributed. Set the storage method to memcache in the PHP configuration file, so PHP itself will establish a session cluster and store session data in memcache.
Note: Synchronizing the session in this way will not increase the burden on the database, and the security is greatly improved compared to using cookies. Putting the session in the memory is much faster than reading from the file.