Last active
May 15, 2018 05:44
-
-
Save Maksclub/892149d8a1639f7aafcc0e1eb4e5f60c to your computer and use it in GitHub Desktop.
Статья про роутинг, код 11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$router->any('/', function() {return('Hello!');}); | |
$router->get('/blog', function() {return('This is Blog');}); | |
$router->post('/blog', function($request) {return('Create Post');}); | |
$router->patch('/blog/(?P<id>\d+)', function($request) {return('Update Post' . $request->getAttribute('id'));}); | |
$router->delete('/blog/(?P<id>\d+)', function($request) {return('Delete Post' . $request->getAttribute('id'));}); | |
// $router->any — метод без указания методов, то есть для любого запроса | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment