php - sessions and cookies
巴扎黑
巴扎黑 2017-05-16 13:06:47
0
4
434

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

巴扎黑
巴扎黑

reply all(4)
给我你的怀抱

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.

Peter_Zhu

You can put session存在memcache或者Redisin

Memcache 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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template