How to share the Session and nodejssession for applications developed by PHP and NodeJs
First, understand the session mechanism.
The client (in the browser) cookie acts as the key value and matches a data on the server. Then the client carries the cookie in the HTTP request each time, and the server "takes it for granted" that the data on the server is targeted at the client.
Some systems like to encrypt session content and put it in cookies.
Then you can
1. You can share the cookie, and then place the data in the places that nodejs and Sorry (PHP) can get, such as redis. In the image, the default php session is written to his own file. So, you need to rewrite it at the same time.
2. The two servers share a set of encryption and decryption methods, but it is not recommended.
The above is all the content of this article. I hope you will like it.