29 lines
1.0 KiB
PHP
Executable File
29 lines
1.0 KiB
PHP
Executable File
<?php
|
|
|
|
declare(strict_types=1);
|
|
/**
|
|
* This file is part of Hyperf.
|
|
*
|
|
* @link https://www.hyperf.io
|
|
* @document https://hyperf.wiki
|
|
* @contact group@hyperf.io
|
|
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
|
*/
|
|
|
|
# 全局中间件
|
|
# http 对应 config/autoload/server.php 内每个 server 的 name 属性对应的值,该配置仅应用在该 Server 中
|
|
# 生成中间件 php ./bin/hyperf.php gen:middleware Auth/FooMiddleware 【Auth = 文件夹名称-可以不带 默默人会生成在 app下的Middleware
|
|
# 文件夹中,若没有自动创建 /FooMiddleware = 中间价名称】
|
|
# composer dumpautoload 执行加载
|
|
|
|
|
|
# 所有的 都需要使用命令执行一遍 后期再复制相同的东西 就可以被注册器发现了 【 request middleware 这些】 使用方法: https://hyperf.wiki/3.0/#/zh-cn/validation
|
|
return [
|
|
'http' => [
|
|
\App\Middleware\CorsMiddleware::class, # 解决跨域 所有中间键
|
|
\Hyperf\Validation\Middleware\ValidationMiddleware::class # request 验证器
|
|
],
|
|
];
|
|
|
|
|