get('/?', function(){ header('Location: /dashboard/'); }); $R->get('dashboard/(?::submenu/)*', function($sm){ var_dump(func_get_args()); $subMenu = $sm; include __ROOT__.'/view.php'; }); $R->get('machines/(?::submenu/)*', function($sm){ $subMenu = $sm; include __ROOT__.'/view.php'; }); $R->get('users/(?::submenu/)*', function($sm){ $subMenu = $sm; include __ROOT__.'/view.php'; }); $R->get('sync/(?::submenu/)*', function($sm){ $subMenu = $sm; include __ROOT__.'/view.php'; }); $R->get('settings/(?::submenu/)*', function($sm){ $subMenu = $sm; include __ROOT__.'/view.php'; }); $R->get('dashboard', function(){ header('Location: /dashboard/'); }); $R->get('machines', function(){ header('Location: /machines/'); }); $R->get('users', function(){ header('Location: /users/'); }); $R->get('sync', function(){ header('Location: /sync/'); }); $R->get('settings', function(){ header('Location: /settings/'); }); $R->get('dashboard/', function(){ include __ROOT__.'/view.php'; }); $R->get('machines/', function(){ include __ROOT__.'/view.php'; }); $R->get('users/', function(){ include __ROOT__.'/view.php'; }); $R->get('sync/', function(){ include __ROOT__.'/view.php'; }); $R->get('settings/', function(){ include __ROOT__.'/view.php'; }); // Correction d' $R->get('.+', function(){ header('Location: /dashboard/'); }); $R->post('.*', function(){ var_dump( 'Acces POST : '.$_GET['url'] ); }); /* [2] On lance le routeur ===================================================*/ $R->run(); ?>