简体   繁体   English

auth()-> loginUsingId(1)和有什么区别? vs Auth :: loginUsingId(1);

[英]What is the difference between auth()->loginUsingId(1); vs Auth::loginUsingId(1);

What is the difference between auth()->loginUsingId(1); auth()->loginUsingId(1);什么区别auth()->loginUsingId(1); vs Auth::loginUsingId(1); vs Auth::loginUsingId(1);

性能不会有差异,因为它们做的是相同的事情。

you will get the same results, but one of them you are calling a global function 您将得到相同的结果,但是其中之一是您调用的全局函数

https://github.com/laravel/framework/blob/5.2/src/Illuminate/Foundation/helpers.php#L136 https://github.com/laravel/framework/blob/5.2/src/Illuminate/Foundation/helpers.php#L136

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM