3.x.com
Set session
4. Can xyun obtain the session through session_id
Why can’t be obtained?
How to set it up
3.x.com
Set session
4. Can xyun obtain the session through session_id
Why can’t be obtained?
How to set it up
This depends on whether you are across different subdomains of the same domain name, or across different domain names. If it is the former, you only need to set the domain parameter of the cookie to example.com
(top-level domain name), and it will work under other subdomains. Obtain the Session_id. If it is the latter, it involves SSO (single sign-on). This is more complicated. This mainly involves the implementation principle of Session. It is recommended to refer to: https://www.zhihu.com/question/19779937
@leiliang520130 and @mistang’s method only realizes cross-server and has nothing to do with Session cross-domain.
You can put the session into redis. Two different domain names can be connected to the same redis, one set and one get
You can set up memcached or redis in php.ini to store sessions, so that they can be stored across servers. The implementation is very simple.