0
나는 젠드 모듈에서 인증을 사용하지만 난 렌더링 할 때 나에게 내 module.config.php 여기 zf2에서 라우팅 오류를 제거하는 방법은 무엇입니까?
Zend\View\Renderer\PhpRenderer::render: Unable to render template "calendar/index/login"; resolver could not resolve to a files
같은 오류입니다 제공 :
:
<?php
return array(
'controllers' => array(
'invokables' => array(
'Calendar\Controller\Index' => 'Calendar\Controller\IndexController',
'Calendar\Controller\User' => 'Calendar\Controller\UserController',
'Calendar\Controller\Calendar' => 'Calendar\Controller\CalendarController',
'Calendar\Controller\Event' => 'Calendar\Controller\EventController'
),
),
'router' => array(
'routes' => array(
/*###############*/
//index
'admin_index' => array(
'type'=>'segment',
'options' => array(
'route'=>'/calendar/admin[/]',
'defaults'=>array('controller'=>'Calendar\Controller\Index','action'=>'index')
)
),
//login
'admin_login' => array(
'type'=>'literal',
'options' => array(
'route'=>'/calendar/admin/login',
'defaults'=>array('controller'=>'Calendar\Controller\Index','action'=>'login')
)
),
//logout
'admin_logout' => array(
'type'=>'literal',
'options' => array(
'route'=>'/calendar/admin/logout',
'defaults'=>array('controller'=>'Calendar\Controller\Index','action'=>'logout')
)
),
//user index
'admin_user' => array(
'type'=>'segment',
'options' => array(
'route'=>'/calendar/admin/user[/]',
'defaults'=>array('controller'=>'Calendar\Controller\User','action'=>'index')
)
),
//user add
'admin_user_add' => array(
'type'=>'segment',
'options' => array(
'route'=>'/calendar/admin/user/add[/]',
'defaults'=>array('controller'=>'Calendar\Controller\User','action'=>'add')
)
),
//user edit
'admin_user_edit' => array(
'type'=>'segment',
'options' => array(
'route' =>'/calendar/admin/user/edit[/:id]',
'constraints' => array(
'action' => 'edit',
'id' => '[a-zA-Z0-9_-]+',
),
'defaults'=>array('controller'=>'Calendar\Controller\User','action'=>'edit')
)
),
//user profile
'admin_profile' => array(
'type'=>'segment',
'options' => array(
'route'=>'/calendar/admin/profile[/]',
'defaults'=>array('controller'=>'Calendar\Controller\Index','action'=>'profile')
)
),
'calendar' => array(
'type' => 'segment',
'options' => array(
'route' => '/calendar[/:action][/:id]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+',
),
'defaults' => array(
'controller' => 'Calendar\Controller\Calendar',
'action' => 'index',
),
),
),
'event' => array(
'type' => 'segment',
'options' => array(
'route' => '/event[/:action][/:id][/:unixTime][/:allDay]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+',
'unixTime' => '[0-9]+',
'allDay' => '0|1',
),
'defaults' => array(
'controller' => 'Calendar\Controller\Event',
'action' => 'index',
),
),
),
),
),
'view_manager' => array(
'template_path_stack' => array(
'calendar' => __DIR__ . '/../view',
),
),
);
여기 내 컨트롤러 액션입니다
public function loginAction(){
//$this->layout('layout/login-layout.phtml');
$login_error=false;
$loginForm = new LoginForm();
if ($this->request->isPost())
{
$loginForm->setData($this->request->getPost());
if ($loginForm->isValid())
{
//die("dgdgdgdgdgdgdgdg");
$data = $loginForm->getData();
$authService = $this->getServiceLocator()
->get('doctrine.authenticationservice.odm_default');
$adapter = $authService->getAdapter();
$adapter->setIdentityValue($data['username']);
$adapter->setCredentialValue(md5($data['password']));
$authResult = $authService->authenticate();
//for disable authentication comment here////////////////////////////
if ($authResult->isValid()) {
$identity = $authResult->getIdentity();
//$authService->getStorage()->write($identity);
$this->redirect()->toRoute('admin_index');
}
else {
$identity =false;
$login_error= true;
}
//for disable authentication comment here////////////////////////////
}
}
//
return new ViewModel(array(
'loginForm' => $loginForm,
'login_error' => $login_error,
));
}
이미 템플릿을 만들었지 만 오류가 있습니다. –
올바른 위치에 있습니까? 코드에서 올바르게 참조 했습니까? –