You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
432 B

1 year ago
  1. <?php
  2. declare (strict_types=1);
  3. namespace app\middleware;
  4. use think\facade\View;
  5. class RefererCheck
  6. {
  7. /**
  8. * 处理请求
  9. *
  10. * @param \think\Request $request
  11. * @param \Closure $next
  12. * @return Response
  13. */
  14. public function handle($request, \Closure $next)
  15. {
  16. if(!checkRefererHost()){
  17. return response('Access Denied', 403);
  18. }
  19. return $next($request);
  20. }
  21. }