## 配置文件
修改配置文件 system/config/middleware.php 中的global配置段
```
'global' => [
\system\middleware\Boot::class,
\system\middleware\Auth::class
]
```
## 創建中間件
中間件需要創建在 server/middleware 目錄中:
文件如下:
```
namespace server\middleware;
class auth {
//執行中間件
public function run($next){
echo "中間件執行了";
$next();
}
}
```
## 全局中間件
全局中間件會在應用啟動時自動執行,不需要人為調用系統會自動執行全局中間件。
修改配置文件 system/config/middleware.php 中的global配置段來設置中間件處理類。