我一直在关注Zend的教程(http://www.youtube.com/watch?feature=player_embedded&v=EerB9bTvqrY),但是当我在项目中添加一个新模块时,我无法导航到它,本教程中的说明是否不正确?在Zend Studio中创建新模块(Zend Framework 2)
基本上,当我在Zend Studio中添加一个新模块到我的Zend Framework项目中时,我无法导航到它,我的新模块被称为“交易”。我导航到本地主机/ dealproject /交易,我得到错误404。当浏览到本地主机/ dealproject /它正确加载zend骨架应用程序页面。
感谢您的帮助。
module.config.php
<?php
return array(
'controllers' => array(
'invokables' => array(
'Deals\Controller\Deals' => 'Deals\Controller\DealsController',
),
),
'router' => array(
'routes' => array(
'deals' => array(
'type' => 'Literal',
'options' => array(
// Change this to something specific to your module
'route' => '/deals',
'defaults' => array(
// Change this value to reflect the namespace in which
// the controllers for your module are found
'__NAMESPACE__' => 'Deals\Controller',
'controller' => 'Deals',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
// This route is a sane default when developing a module;
// as you solidify the routes for your module, however,
// you may want to remove it and replace it with more
// specific routes.
'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(
),
),
),
),
),
),
),
'view_manager' => array(
'template_path_stack' => array(
'Deals' => __DIR__ . '/../view',
),
),
);
能否请你告诉我们,从导致问题:) –
现在我已经发布module.config.php模块的module.config.php你的路由配置在问题中。谢谢你的帮助。 – Jonjon
谢谢,它看起来不错:)。我发布了一个答案,希望它能帮助你解决你的404错误:) –