Slim 3 get current route in middleware

后端 未结 5 1930
故里飘歌
故里飘歌 2021-01-04 13:30

I want to get the name of the current I route in a middleware class. Previously (in Slim 2.*) you could fetch the current route like so:

$route = $this->ap

5条回答
  •  -上瘾入骨i
    2021-01-04 14:19

    Apparently you can configure Slim to determine the route before going into the middleware with this setting:

    $app = new Slim\App([
        'settings'  => [
            'determineRouteBeforeAppMiddleware' => true,
        ]
    ]);
    

    I'm not sure what kind of impact this has, but it works for me :)

提交回复
热议问题