Created
February 7, 2015 05:03
-
-
Save enlacee/c98c7c99f4dca476e659 to your computer and use it in GitHub Desktop.
configuracion de router zf2
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 | |
// http://localhost/iglesia-bb/public/persona/index/123 | |
// http://localhost/iglesia-bb/public/persona/index/123/enlacee- | |
'router' => array( | |
'routes' => array( | |
'Persona' => array( | |
'type' => 'Literal', | |
'options' => array( | |
'route' => '/persona', | |
'defaults' => array( | |
'__NAMESPACE__' => 'Persona\Controller', | |
'controller' => 'Index', | |
'action' => 'index', | |
), | |
), | |
'may_terminate' => true, | |
'child_routes' => array( | |
'default' => array( | |
'type' => 'Segment', | |
'options' => array( | |
'route' => '/:controller[/:action][/:id][/:nick]', // router opcional (op1) | |
//'route' => '/[:controller[/:action][/:id][/:nick]]', // router opcional (op2) | |
//'route' => '/[:controller[/:action][/:id/:nick]]', // router obligatorio [id/nick] | |
'constraints' => array( | |
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*', | |
'action' => '[a-zA-Z][a-zA-Z0-9_-]*', | |
'id' => '[0-9][0-9]*', | |
'nick' => '[a-z][a-z_-]*' | |
), | |
'defaults' => array( // establecer valores por defecto | |
'controller' => 'persona', | |
'action' => 'index', | |
'id' => '111', | |
'nick' => 'anibal' | |
), | |
), | |
), | |
), | |
), | |
), | |
), | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment