그래서 User라는 이름의 모듈이 있고이 모듈 안에 일부 컨트롤러가 있습니다. 이제 로그 아웃 컨트롤러가 있는데 url (domain.tld/user/logout)을 만들고 싶습니다. 내 견해에있어이 관제사에게. 나는이 같은 시도 : 정의 된 경로가없는 ZF2 url보기 도우미
$this->url("user/logout"); //This doesn't work since there isn't a child route defined for the user
그래서 내 질문은
의module.config.php
의 경로를 정의없이 URL보기 도우미를 사용하여 URL을 정의 할 수있는 옵션이있다 :
$this->url("user",array("controller" => "logout")); //This doesn't work
나는이 같은 시도 여기
유엔에 module.config.php
return array(
'router' => array(
'routes' => array(
'register' => array(
'type' => 'Zend\Mvc\Router\Http\Literal',
'options' => array(
'route' => '/user',
'defaults' => array(
'controller' => 'User\Controller\Index',
'action' => 'index',
),
),
),
'user' => array(
'type' => 'Literal',
'options' => array(
'route' => '/user',
'defaults' => array(
'__NAMESPACE__' => 'User\Controller',
'controller' => 'Index',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
'default' => array(
'type' => 'Segment',
'options' => array(
'route' => '/[:controller[/:action]]',
'constraints' => array(
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
),
),
),
와우, 훌륭한 지식, 정말로 고맙습니다, 고맙습니다! – Uffo