Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加middleware 不生效 #10

Open
aizxin opened this issue May 30, 2020 · 3 comments
Open

添加middleware 不生效 #10

aizxin opened this issue May 30, 2020 · 3 comments
Assignees

Comments

@aizxin
Copy link

aizxin commented May 30, 2020

        // Not in group
        if (!$this->currentGroupPrefix) {
            return;
        }

middleware,use 在路由中都不生效
只有在group里的单个路由才生效

// Prepend group middleware at before.
        if ($this->currentGroupChains) {
            $route->setChains(array_merge($this->currentGroupChains, $route->getChains()));
        }

数组合并是不是用问题,不知道设计是几维数组,middleware 都是一维数组嘛??

Route::use(['api'])->group('/api', function () {
    Route::get('/test', \app\controller\IndexController::class . '@index')->middleware(['api1']);
},['api2','api3']);

dump 的middleware $router->getChains()

array(3) {
  [0]=>
  string(4) "api2"
  [1]=>
  string(4) "api3"
  [2]=>
  array(1) {
    [0]=>
    string(4) "api1"
  }
}

@inhere inhere self-assigned this May 30, 2020
@inhere
Copy link
Owner

inhere commented May 31, 2020

我测试检查下

@inhere
Copy link
Owner

inhere commented Jun 1, 2020

@aizxin
->middleware(['api1']) 这里写错了,该是:

->middleware('api1') 多个这样写: ->middleware('api1', 'api4', 'api5')

我加下检查限制

@licat233
Copy link

现在的Nginx.conf配置会让导致无法获取GET参数

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants