php - Zend Framework 2 Routes not working -
so have new , fresh installation of zf2, works, except if create new controller... foocontroller.php , go application/foo 404 don't why, have setup routes, in zf1 worked out of box
<?php /** * zend framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zendskeletonapplication canonical source repository * @copyright copyright (c) 2005-2013 zend technologies usa inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd new bsd license */ namespace application\controller; use zend\mvc\controller\abstractactioncontroller; use zend\view\model\viewmodel; class foocontroller extends abstractactioncontroller { public function indexaction() { $view = new viewmodel(array( 'foo' => 'the foo controller' )); return $view; } }
yes need setup @ leaast 1 route. can setup generic route handle controller/action type routing:
/** * generic route */ 'generic_route' => array( 'type' => 'segment', 'options' => array( 'route' => '[/:controller[/:action[/:id[/:extra]]]][/]', 'constraints' => array( '__namespace__' => 'application\controller', 'action' => '[a-za-z][a-za-z0-9_-]*', 'controller' => '[a-za-z][a-za-z0-9_-]*', 'id' => '[0-9]+', 'extra' => '[a-za-z0-9_-]+', ), 'defaults' => array( 'controller' => 'index', 'action' => 'index', ), ), ),
Comments
Post a Comment