我想获取当前路由组。
例如group1
from
$app->group('/group1', function () use ($app) {
$app->get("/a"...
$app->get("/b"...
$app->get("/c"...
...
我可以从当前路由中获得路由模式。
问题是- 是否有任何特殊的方式来获得当前路由组?
$this
呢?代码来自他们的网站。
$app = new 'Slim'App();
$app->group('/users/{id:[0-9]+}', function () {
$this->map(['GET', 'DELETE', 'PATCH', 'PUT'], '', function ($request, $response, $args) {
// Find, delete, patch or replace user identified by $args['id']
})->setName('user');
$this->get('/reset-password', function ($request, $response, $args) {
// Reset the password for user identified by $args['id']
})->setName('user-password-reset');
});