0
젠드 2 사용자 지정 사용자 모듈을 만들려고하는데 "세그먼트"와 "리터럴"에서 라우팅 문제가 있습니다.젠드 프레임 워크 2 라우팅 오류
나는 해결책을 찾지 않고 많이 봤어. 내 모듈은 "사용자"입니다.
URL siteurl/user/login or siteurl/user
에 액세스하려고하면 오류가 발생합니다.
"The requested controller could not be mapped to an existing controller class."
"module \ User \ src \ User \ Controller \ UserController"에 이미 사용자 컨트롤러가 있습니다.
module.config.php에 경로를 정의했습니다.
return array(
'controllers' => array(
'invokables' => array(
'User\Controller\User' => 'User\Controller\UserController',
),
),
// The following section is new and should be added to your file
'router' => array(
'routes' => array(
'user' => array(
'type' => 'Literal',
'priority' => 1000,
'options' => array(
'route' => '/user',
'defaults' => array(
'controller' => 'user',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
'login' => array(
'type' => 'Literal',
'options' => array(
'route' => '/user/login',
'defaults' => array(
'controller' => 'user',
'action' => 'login',
),
),
),
'authenticate' => array(
'type' => 'Literal',
'options' => array(
'route' => '/user/authenticate',
'defaults' => array(
'controller' => 'user',
'action' => 'authenticate',
),
),
),
'logout' => array(
'type' => 'Literal',
'options' => array(
'route' => '/user/logout',
'defaults' => array(
'controller' => 'user',
'action' => 'logout',
),
),
),
'register' => array(
'type' => 'Literal',
'options' => array(
'route' => '/user/register',
'defaults' => array(
'controller' => 'user',
'action' => 'register',
),
),
),
'changepassword' => array(
'type' => 'Literal',
'options' => array(
'route' => '/user/change-password',
'defaults' => array(
'controller' => 'user',
'action' => 'changepassword',
),
),
),
'changeemail' => array(
'type' => 'Literal',
'options' => array(
'route' => '/user/change-email',
'defaults' => array(
'controller' => 'user',
'action' => 'changeemail',
),
),
),
),
),
),
),
'view_manager' => array(
'template_path_stack' => array(
'album' => __DIR__ . '/../view',
),
),
);
무엇이 여기에 있습니까?
작동 :)라는 컨트롤러를 찾을 방법을 알고하지 않습니다. 큰. 덕분에 – shail
다른 접근법은 명명 된 컨트롤러를 사용하는 것입니다. 나는. 'invokable''사용자'를 이름 짓는다. – Sam