Skip to content

Instantly share code, notes, and snippets.

@phalcon
Last active December 19, 2015 00:59
Show Gist options
  • Select an option

  • Save phalcon/5872605 to your computer and use it in GitHub Desktop.

Select an option

Save phalcon/5872605 to your computer and use it in GitHub Desktop.
<?php
$router = new \Phalcon\Mvc\Router();
$router->add('/:module/:controller/:params',
array(
'module' => 1,
'controller' => 2,
'action' => 'index'
)
);
$router->add('/:module/:controller/:action/:params',
array(
'module' => 1,
'controller' => 2,
'action' => 3
)
);
foreach (['/index/index', '/index/index/', '/index0/index/'] as $uri) {
$router->handle($uri);
//var_dump($router->getMatchedRoute());
var_dump($uri);
var_dump($router->getModuleName());
var_dump($router->getControllerName());
var_dump($router->getActionName());
echo '<br/>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment