0

Slim 3 ルートで or-option を使用するにはどうすればよいですか?

たとえば、これは私が現在行っていることです:

// 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) {
...}
4

1 に答える 1

1

オプションのセグメントは、あなたが探しているものです。

于 2016-04-07T09:16:00.607 に答える