page d'accueil $R->get('/?', function(){ header('Location: /dashboard/'); }); // nomPage/arg1/arg2 -> inclusion de la page $R->get('dashboard(?:/[\w-]+)*/?', function(){ include __ROOT__.'/view.php'; }); $R->get('machines(?:/[\w-]+)*/?', function(){ include __ROOT__.'/view.php'; }); $R->get('users(?:/[\w-]+)*/?', function(){ include __ROOT__.'/view.php'; }); $R->get('analytics(?:/[\w-]+)*/?', function(){ include __ROOT__.'/view.php'; }); $R->get('settings(?:/[\w-]+)*/?', function(){ include __ROOT__.'/view.php'; }); // nomPage -> nomPage/ $R->get('dashboard', function(){ header('Location: /dashboard/'); }); $R->get('machines', function(){ header('Location: /machines/'); }); $R->get('users', function(){ header('Location: /users/'); }); $R->get('analytics', function(){ header('Location: /analytics/'); }); $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('analytics/', function(){ include __ROOT__.'/view.php'; }); $R->get('settings/', function(){ include __ROOT__.'/view.php'; }); // Dispatcher $R->get('f(?:/([\w-]+))*/?', function(){ new manager\ResourcesDispatcher($_GET['url']); }); // N'importe -> page d'accueil $R->get('.+', function(){ header('Location: /dashboard/'); }); $R->post('.*', function(){ var_dump( 'Acces POST : '.$_GET['url'] ); }); /* [2] On lance le routeur ===================================================*/ $R->run(); ?>