Created
November 25, 2012 00:24
-
-
Save phalcon/4141922 to your computer and use it in GitHub Desktop.
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
<?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