First understand the mechanism of session
The client (in the browser) cookie serves as a key value, matching a piece of data on the server side. Then the client carries that cookie in every HTTP request, and then the server "naturally" thinks that the data on the server is for the client.
Some systems like to encode and encrypt the session content and store it in cookies
Then you can
1. You can share cookies, and then put the data in a place where both nodejs and PHP can access it, such as redis. In the image, the default session of PHP writes its 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 the entire content of this article, I hope you all like it.