2013-06-23 2 views
5

저는 ZF2를 시작하려고하는데 ZF 웹 사이트의 튜토리얼에서 코드를 작성할 때 문제가 있습니다. 내 코드 :ZF2 : 모듈을 초기화 할 수 없습니다.

Module.php: 
<?php 
namespace About; 

class About 
{ 
    public function getAutoloaderConfig() 
    { 
     return array(
      'Zend\Loader\ClassMapAutoloader' => array(
       __DIR__ . '/autoload_classmap.php', 
      ), 
      'Zend\Loader\StandardAutoloader' => array(
       'namespaces' => array(
        __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, 
       ), 
      ), 
     ); 
    } 

    public function getConfig() 
    { 
     return include __DIR__ . '/config/module.config.php'; 
    } 
} 
?> 

config/module.config.php: 

<?php 
return array(
    'controllers' => array(
     'invokables' => array(
      'About\Controller\About' => 'About\Controller\AboutController', 
     ), 
    ), 

    'router' => array(
     'routes' => array(
      'album' => array(
       'type'  => 'segment', 
       'options' => array(
        'route'  => '/about[/:action][/:id]', 
        'constraints' => array(
         'action' => '[a-zA-Z][a-zA-Z0-9_-]*', 
         'id'  => '[0-9]+', 
        ), 
        'defaults' => array(
         'controller' => 'About\Controller\About', 
         'action'  => 'index', 
        ), 
       ), 
      ), 
     ), 
    ), 

    'view_manager' => array(
     'template_path_stack' => array(
      'about' => __DIR__ . '/../view', 
     ) 
    ), 
); 

문제이다 : 그것은 시작에

Fatal error: Uncaught exception 'Zend\ModuleManager\Exception\RuntimeException' with message 'Module (About) could not be initialized.' in /var/www/zend2/vendor/zendframework/zendframework/library/Zend/ModuleManager/ModuleManager.php on line 175 

을 보여 있어요 이유는 무엇입니까? (내 프로젝트 :/var/www/zend2 /). application.config.php에서 모듈 선언을 제거하면 올바르게 작동합니다. 내 문제는 무엇입니까? :/

+0

또한 Linux에서 모듈 폴더 권한과 소유자를 확인해야합니다. –

답변

9

아야, 해결!
Module.php 클래스의 이름은 Module이어야하며 ...

+1

또한 모듈의 네임 스페이스를 확인하십시오. – Garry

관련 문제