Skip to content

Commit

Permalink
改进全局中间件执行
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Oct 30, 2018
1 parent 5934dae commit dd96c13
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Application.php
Expand Up @@ -68,6 +68,14 @@ public function swoole(Request $request, Response $response)
// 更新请求对象实例
$this->route->setRequest($this->request);

// 重新加载全局中间件
if (is_file($this->appPath . 'middleware.php')) {
$middleware = include $this->appPath . 'middleware.php';
if (is_array($middleware)) {
$this->middleware->import($middleware);
}
}

$resp = $this->run();
$resp->send();

Expand Down

0 comments on commit dd96c13

Please sign in to comment.