How do applications developed by PHP and NodeJs share Session

  • 2020-05-30 19:25:53
  • OfStack

First of all, understand the mechanism of session

The client (in the browser) cookie is used as the key value to match 1 data on the server side. The client then carries that cookie in each HTTP request, and the server "takes it for granted" that the data on the server side is for that client.
Some systems like to encode session content and encrypt it inside cookie

So you can

1. You can share cookie and put the data where nodejs and Sorry (which is PHP) are available, such as redis. The default session for php in the image is to write his own files, So, which you need to rewrite 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 can enjoy it.


Related articles: