2016-11-04 186 views
0

Zend框架2是新的。发生我已经下载Zend的骨架应用其工作fine.but当我创建的相册&的新模块调用专辑路线页面没有找到错误(404)ZF2路由问题

我试图应用许多类型的zf2路由,但相同的错误消息。

这是正在显示错误页面再次&当我再次访问专辑路线:

enter image description here

我不知道为什么会发生这种错误?请向我建议任何解决方案?

+1

告诉我你的'module.config.php' –

回答

0

测试一下Module.php它应该是这个样子

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

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

中的所有模块文件特别检查命名空间 您module.config.php应该是这样的

'controllers' => array(
    'invokables' => array(
     'index' => 'Album\Controller\IndexController', 
    ), 
), 

'router' => array(
    'routes' => array(
     'album' => array(
      'type' => 'literal', 
      'options' => array(
       'route' => '/album', 
       'defaults' => array(
        'controller' => 'index', 
        'action'  => 'index', 
       ), 
      ), 


     ), 
    ), 
), 

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

我希望它能帮助你。

+0

当然,你需要添加新的模块配置\ application.config.php –

+0

回报阵列( //这应该是在使用的模块命名空间的数组应用程序。 “模块” =>数组( “应用”, –

+0

返回阵列( //这应该是在本申请中使用的命名空间模块的阵列。 “模块” =>数组( “应用”, –