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.

29 lines
608 B

3 years ago
  1. <?php
  2. declare (strict_types = 1);
  3. namespace app\middleware;
  4. use think\facade\Db;
  5. use think\facade\Config;
  6. class LoadConfig
  7. {
  8. /**
  9. * 处理请求
  10. *
  11. * @param \think\Request $request
  12. * @param \Closure $next
  13. * @return Response
  14. */
  15. public function handle($request, \Closure $next)
  16. {
  17. $res = Db::name('config')->cache('configs',0)->column('value','key');
  18. Config::set($res, 'sys');
  19. return $next($request)->header([
  20. 'Cache-Control' => 'no-store, no-cache, must-revalidate',
  21. 'Pragma' => 'no-cache',
  22. ]);
  23. }
  24. }