我一直在关注 Zend 的教程(http://www.youtube.com/watch?feature=player_embedded&v=EerB9bTvqrY)但是当我在我的项目中添加一个新模块时,我无法导航到它,是本教程中的说明不正确?
基本上,当我在 Zend Studio 中将一个新模块添加到我的 Zend Framework 项目时,我无法导航到它,我的新模块称为“交易”。我导航到 localhost/dealproject/deals 并收到错误 404。当导航到 localhost/dealproject/ 时,它会正确加载 zend 框架应用程序页面。
谢谢你的帮助。
模块.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',
),
),
);