Slim 3 - как добавить или вариант в маршрут?
Как я могу иметь или-вариант в маршрутах Slim 3?
Например, это то, что я делаю в настоящее время:
// Home page.
$app->get('/', function (Request $request, Response $response, array $args) {
// Get the application settings.
$settings = $this->get('settings');
// Check if the home page class is provided.
... lots of codes
});
$app->get('/home', function (Request $request, Response $response, array $args) {
// Get the application settings.
$settings = $this->get('settings');
// Check if the home page class is provided.
... lots of codes
});
вместо того, чтобы повторять фрагменты этих кодов, могу ли я сделать их такими:
$app->get('/ or /home', function (Request $request, Response $response, array $args) {
...}
1 ответ
Решение