Home  >  Article  >  Web Front-end  >  How applications developed with PHP and NodeJs share Session_node.js

How applications developed with PHP and NodeJs share Session_node.js

WBOY
WBOYOriginal
2016-05-16 16:03:461872browse

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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn