The sharing session between Laravel project and other projects is summarized here. some people may need it later,
In fact, Laravel's session is not a session manager that comes with PHP. Instead, we fully implement one by ourselves.
Note that it is completely self-implemented. it is not a session processor defined by session_set_save_handler in the traditional sense.
So it's easy to solve the problem of sharing sessions with another ThinkPHP Project ~
Start the session that comes with PHP in Laravel, that is, session_start.
This is their code comment "Note that the Laravel sessions do not make use of PHP" native "sessions in any way since they are crappy ."
Remember that Laravel does not use a PHP "native" session anywhere, because it is very poor.
Okay, now I only need to start a bad session.
By kankana
The preceding figure shows how to access sessions of other programs from laravel.
The following describes how to access laravel's session (file) from outside ).
When laravel's session driver is set to file, these session files are stored in app/storage/sessions in json format.
The key is how to find the corresponding session file?
This file name is encrypted and stored in the laravel_session of the cookie.
How can I decrypt laravel_session to obtain the file name?
1. first install this library:
Https://github.com/illuminate/encryption
2. get the encryption key
Key in app/config/app. php
3,
$ Encrypter = new Illuminate \ Encryption \ Encrypter ($ key );
$ Session_filename = $ encrypter-> decrypt ($ _ COOKIE ['laravel _ session']);
This is roughly the case.
======================================
==========================================
The best practice for Session sharing between projects is to store Session information in Redis or databases, for example, only Redis or database can be read.