Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
262 views
in Technique[技术] by (71.8m points)

laravel,Auth::basic()和Auth::onceBasic()的区别是什么?

Route::get('/', function (IlluminateHttpRequest $request) {

    dd(Auth::basic(),Auth::onceBasic(),$request->cookie(),$request->session(),Auth::id(),Auth::check(),Auth::user());
})->middleware('auth.basic.once');

Route::get('/base', function (IlluminateHttpRequest $request) {

    dd($request->cookie(),$request->session(),Auth::id(),Auth::check(),Auth::user());
})->middleware('auth.basic.once');

如上我的代码,auth.basic.once和auth.basic互相替换了一次,我作为用户操作时,感觉没区别啊,都只是登录一次,/和/base就都能访问了。
官方文档如下,http://d.laravel-china.org/do...

Route::get('api/user', function () {

})->middleware('auth.basic.once');
Route::get('api/user', function () {

})->middleware('auth.basic');

又谁能说下具体用法吗


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...