2014-02-16 3 views
0

나는 ZF2로 구걸하고있다. 내가보기에 사용할 때 라우터를하려고합니다. 이 오류가 있습니다 : 치명적인 오류 : '경로명이있는 "문서"찾을 수 없음 "메시지와 함께'Zend \ Mvc \ Router \ Exception \ RuntimeException '의 캐치 예외젠드 프레임 워크 2 라우터

도와 주시겠습니까?

내 코드입니다 : 사용자가 정의한 '경로'이름이

+1

당신은 당신이이 오류를 생성하는 뷰에서 사용하고있는 코드를 포함하는 질문을 편집 할 수 있을까요? –

답변

0

<?php 
return array(
    'controllers' => array(
     'invokables' => array(
      'Documents\Controller\Documents' => 'Documents\Controller\DocumentsController', 

     ), 
    ), 
    'router' => array(
     'routes' => array(
      'documents' => array(
       'type' => 'segment', 
       'options' => array(
        'route' => '/DocumentsController[/:action]', 
        'constraints' => array(
         'action' => '[a-zA-Z][a-zA-Z0-9_-]*', 

        ), 
        'defaults' => array(
                '__NAMESPACE__' => 'Documents\Controller', 
         'controller' => 'Documents\Controller\DocumentsController', 
         'action' => 'add', 
        ), 
       ) 
      ) 

      ) 
     ) 
); 

감사합니다 '문서'

과 아래 라인

'route' => '/DocumentsController[/:action]', 

을 변경해보십시오

'route' => '/documents[/:action]', 


또한 뷰 파일로 URL을 생성 - 예 :

<?php echo $this->url('documents', array('action' => 'index')); ?>