search

Home  >  Q&A  >  body text

laravel session storage failedSession store not set on request.

I just learned laravel, how to use this session?

This will result in an error

Request::session()->put('user', 'test');

Error content: Session store not set on request.

How to solve this?

某草草某草草2752 days ago701

reply all(3)I'll reply

  • PHPz

    PHPz2017-05-16 16:54:20

    You should be fine if you update Laravel to 5.2.27 and later versions.
    Refer to Laravel5.2.27 to automatically add web middleware to each page

    reply
    0
  • 黄舟

    黄舟2017-05-16 16:54:20

    The session configuration file is configured in config/session.php
    You can check to see if your configuration is wrong

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-16 16:54:20

    If you are laravel5.2, when using session status, csrf protection and other functions, you must use the "web" middleware

    Route::group(['middleware' => ['web']], function () {
        // your routes here
    });

    reply
    0
  • Cancelreply