我一直在關注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錯誤:) –