我如何在Slim 3 routes中拥有or-option?
例如,这就是我目前所做的事情:
(gdb)
(gdb) source pythonstart.py
Python 2.7.6 (default, Jun 22 2015, 18:00:18)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
>>> exit()
(gdb) <---- Pressing Enter here
Python 2.7.6 (default, Jun 22 2015, 18:00:18)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
而不是重复这些代码的块,我可以把它们变成像:
// 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
});