I've configured config/session.php
return [
'driver' => 'file',
'lifetime' => 120,
'expire_on_close' => false,
'encrypt' => false,
'files' => storage_path('framework/sessions'),
'connection' => null,
'table' => 'sessions',
'lottery' => [2, 100],
'cookie' => 'laravel_session',
'path' => '/',
'domain' => null,
'secure' => false,
];
I put route rule in the group web
Route::group(['middleware' => ['web']], function () {
Route::get('/example/demo', 'ExampleController@demo');
});
The folder of storage can be written but every request will be to generate a new session file
How did this happen?
How can I solve this problem?
If you just want to see contents of session, try dd() : dd(session()->all()); If not, just use this to get all info: $data = session()->all();
Laravel utilize basically the original session file store but acts a little bit different. Beside changing the directory they are saved, when you call the regenerate function it creates another session file and deletes the old one. You can see it the implementation Illuminate\Session\Store. php .
The correct syntax for this is: Session::set('variableName', $value); For Laravel 5.4 and later, the correct method to use is put : Session::put('variableName', $value);
Problem is in this line :
'cookie' => 'laravel_session'
I don't know what causes the problem, laravel or browser but you can not use _
or .
in cookie name.Removing underscore from cookie name will solve the problem.
And also i found this for IE : http://blogs.msdn.com/b/ieinternals/archive/2009/08/20/wininet-ie-cookie-internals-faq.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With