2016-09-26 2 views
0

Hier ist mein Zend Framework Modul config:Zend Framework Router 404 Fehler

'routes' => [ 

      'home' => [ 
       'type' => Literal::class, 
       'options' => [ 
        'route' => '/', 
        'defaults' => [ 
         'controller' => Controller\IndexController::class, 
         'action'  => 'index', 
        ], 
       ], 
      ], 

      'default' => array(
       'type' => 'segment', 
       'options' => array(
        'route' => '/[:controller[/:action]]', 
        'defaults' => array(
         '__NAMESPACE__' => 'Application\Controller', 
         'controller' => 'Index', 
         'action'  => 'index', 
        ), 
        'constraints' => [ 
         'controller' => '[a-zA-Z][a-zA-Z0-9_-]*', 
         'action'  => '[a-zA-Z][a-zA-Z0-9_-]*', 
        ] 
       ), 
      ) 
... 
'controllers' => [ 
     'factories' => [ 
      Controller\IndexController::class => InvokableFactory::class, 
     ], 

und meine IndexController.php sieht wie folgt aus:

class IndexController extends AbstractActionController 
{ 
    public function indexAction() 
    { 
     return new ViewModel(); 
    } 

    public function testAction() 
    { 
     echo 1; 
     return 1; 
    } 
} 

ich eine richtige Antwort erhalten möchte, wenn ich http://host/Index/test zugreifen, aber jetzt bekomme ich eine 404 error und eine Beschreibung wie:

"Der angeforderte Controller konnte nicht sein einer vorhandenen Controller-Klasse zugeordnet ... ".

Was ist das Problem?

Antwort

0

Versuchen Sie, 'type' => 'segment' zu 'type' => 'Segment'

zu ändern