Skip to content

Instantly share code, notes, and snippets.

@phalcon
Created November 25, 2012 00:24
Show Gist options
  • Save phalcon/4141922 to your computer and use it in GitHub Desktop.
Save phalcon/4141922 to your computer and use it in GitHub Desktop.
<?php
$routes = array(
'/',
'/index',
'/index/index',
'/index/test',
'/test',
'/test/index/',
'/test',
);
$router = new Phalcon\Mvc\Router();
//Testing each route
foreach ($routes as $route) {
//Handle the route
$router->handle($route);
echo 'Testing ', $route, '<br>';
//Check if some route was matched
if ($router->wasMatched()) {
echo 'Controller: ', $router->getControllerName(), '<br>';
echo 'Action: ', $router->getActionName(), '<br>';
} else {
echo 'The route wasn\'t matched <br>';
}
echo '<br>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment