laravel session :: flash和request-> session-> flash的区别 [英] laravel difference of session::flash and request->session->flash
本文介绍了laravel session :: flash和request-> session-> flash的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道性能和使用优势有何区别?
i wonder that what is the differences in performance and usage advantage ?
public function delete(){
\Session::flash('success', __('common.message.success.delete'));
}
与
public function delete(){
$request->session()->flash('success', __('common.message.success.delete'))
}
请用一个开放的例子对此进行解释.哪个是性能最好的,哪个是会话中正确使用的方法?
please explain it with an open example. which one is the best performance provide and which one of the right way usage at session ?
推荐答案
它们只是访问应用程序会话对象的不同方法.使用 laravel
,您可以访问应用程序会话
They are just different ways of accessing your application's session object. With laravel
You can access application session
- 将会话外观用作
Session ::
- 使用
request的
会话方法$ request-> session()
- Using session facade as
Session::
- Using
request's
session method$request->session()
您可以在此处用于会话的laravel文档中进行阅读.希望对您有所帮助!
You can read on it here laravel docs for session. Hope it helps !
这篇关于laravel session :: flash和request-> session-> flash的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文