Laravel中Session :: set和Session :: put有什么区别? [英] What is the difference between Session::set and Session::put in Laravel?
本文介绍了Laravel中Session :: set和Session :: put有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Laravel中的Session::set
和Session::put
方法之间有什么区别?该文档仅涵盖Session::put
,但我已经看到使用set
代替.
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.
推荐答案
它们完全相同. Session::put
直接调用Session::set
.
They are exactly the same. Session::put
directly calls Session::set
.
唯一的区别是,Session::put
允许您将其传递给[key => value]
对的数组,在这种情况下,它会为每个对调用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.
这些方法在 Illuminate\Session\Store
中定义
These methods are defined in Illuminate\Session\Store
这篇关于Laravel中Session :: set和Session :: put有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文