What is the difference between Session::set and Se

2020-08-23 04:19发布

问题:

What is the difference between the Session::set and Session::put methods in Laravel? The docs only covers Session::put, but I have seen set used instead.

回答1:

They are exactly the same. Session::put directly calls Session::set.

The only difference, is that Session::put allows you to pass it an array of [key => value] pairs, in which case it calls Session::set for each of them.

These methods are defined in Illuminate\Session\Store



标签: laravel