laravel5.2 session usage
迷茫
迷茫 2017-05-16 16:50:26
0
3
435

Excuse me, how to store, get the value and clear the session in laravel5.2.
I followed the documentation, but after storing it in controller A, I could not get the value in controller B.

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(3)
迷茫
// 存值
$request->session->put(key,value);

// 取值
$request->session->get(key);

// 清空
$request->session->flush()

You can read the documentation
http://laravelacademy.org/post/3261.html

迷茫

The laravel file is really too rough. The session is probably a trap for many people. If it is not a normal return control layer function, you need to call session()->save()

某草草

There are two main points to pay attention to when using session add, delete, modify and check:
First, the session.php configuration is correct;
Second, the add, delete, modify, and check functions are not written incorrectly.

For the source code analysis of session, please see: Laravel Study Notes: Session Source Code Analysis (Part 1)

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template