Laravel Project and other project sharing session issues

Source: Internet
Author: User
I'm going to summarize this, maybe someone will need it later,
In fact, Laravel's session is not a session manager that comes with PHP. It's a completely self-fulfilling one.
Note is completely self-fulfilling, not the traditional use of Session_set_save_handler custom session processor.

So it's easy to solve the problem of sharing the session with another thinkphp project.
It would be nice to start PHP's own session in Laravel, which is session_start.

This is their code comment "Note that the Laravel sessions does not make a use of PHP" native "sessions on any means since they is crappy."
Remember that Laravel doesn't use PHP's "native" session anywhere, because it's lame.

All right, I just have to start the crappy session right now.

by Kankana

The above is how to access other programs from Laravel session.

The following is how to access the Laravel session (file) from outside.

When Laravel's session driver is set to file, these session files are stored in JSON form in app/storage/sessions.

The key is, how to find the corresponding session file?

This file name is stored in encrypted form in the laravel_session of the cookie.

How do I decrypt laravel_session to get this 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 ');

Roughly so.


================================

===================================

The best practice for session sharing between projects should be the presence of session information such as Redis or database projects simply by reading Redis or database

  • 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.