我想获得当前的路线组 例如来自
的group1
$app->group('/group1', function () use ($app) {
$app->get("/a"...
$app->get("/b"...
$app->get("/c"...
...
我可以从当前路线获得路线模式。
问题是 - 是否有任何特殊方式来获取当前路线组?
答案 0 :(得分:0)
$this
怎么样?代码取from their website.
$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');
});