How to share the Session and nodejssession for applications developed by PHP and NodeJs

Source: Internet
Author: User
Tags php session

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.