Welcome to the Linux community forum and interact with 2 million technical staff to enter the php session cross-Origin Cross-server solution: Check it online, except asp.net, all sessions must be retained with sessionid. The storage location of the Session is as follows: shared files, databases, and memcache. The main problem is
Welcome to the Linux community forum and interact with 2 million technical staff> go to the php session cross-Origin Cross-server solution: Check it online, except for asp.net, the session id must be used to retain all sessions. The storage location of the Session is as follows: shared files, databases, and memcache. The main problem is
Welcome to the Linux community forum and interact with 2 million technicians>
In php, the cross-Origin Cross-Server Solution of session: After checking on the Internet, except asp.net, all session retention must use the session id. The storage location of the Session is as follows: shared files, databases, and memcache. Therefore, the main problems are the transfer of session IDs.
The Session id is transmitted in four ways:
1. Use cookies.
2. Set session. use_trans_sid = 1 in php. ini or enable the -- enable-trans-sid option when compiling, so that PHP can automatically pass the session id across pages.
3. Manually pass values through URLs or hide forms.
4. It is transmitted as a file or database, and the value is corresponding to another key.
The above two and three actually use the same method, but the approach is different.
Through the above analysis, we can easily see that passing session IDs through cookies and storing sessions on the memcache Server is a reasonable choice. When cross-origin occurs, you can use p3p to set cookie cross-origin. When the client disables the cookie, you can set php. ini to automatically pass the session id through the url.
The following uses pass as an example to describe the logic implementation process (depending on the requirements, If You Want To ensure interface consistency and shield the session server from other servers, all login and session information can be transferred through the login server, but this will naturally lead to time delays and the risk of Full-site paralysis caused by server downtime ):
Including services and applications: log on to the server, save the memcache server for the session, the application server, the public key, and the key
(1) For trusted servers: