laravel except和only的区别

except:黑名单机制,除了show页面不需要通过中间件auth过滤,其他页面都需要

public function __construct(){
	$this->middleware('auth', ['except' => 'show']);
}

only:白名单机制,只有show页面需要通过中间件auth过滤,其他页面不需要

 public function __construct(){
   $this->middleware('auth', ['only' => 'show']);
}
发布了48 篇原创文章 · 获赞 0 · 访问量 341

猜你喜欢

转载自blog.csdn.net/qq_21389693/article/details/105712860
今日推荐