【发布时间】:2014-06-27 23:24:29
【问题描述】:
我正在 zf2 中开发一个应用程序。当我在module.config.php 中定义路由并在浏览器中访问它们时,php 会抛出错误:
Fatal error: Class 'BookList\src\BookList\Controller\BookController' not found in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC9\data\localweb\projects\autoclick\skeleton-application\vendor\zendframework\zendframework\library\Zend\ServiceManager\AbstractPluginManager.php on line 170
这是我的 module.config.php :
return array(
'controllers' => array(
'invokables' => array(
'BookList\src\BookList\Controller\Book' => 'BookList\src\BookList\Controller\BookController'
)
),
'router' => array(
'routes' => array(
'book' => array(
'type' => 'segment',
'options' => array(
'route' => '/book[/][:action][/:id]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+'
),
'defaults' => array(
'controller' => 'BookList\src\BookList\Controller\Book',
'action' => 'index'
)
)
)
)
),
'view_manager' => array(
'template_path_stack' => array(
'book' => __DIR__ . '/../view'
)
)
我的BookController 命名空间为BookList\src\BookList\Controller
【问题讨论】:
-
你为你的模块设置了自动加载器吗?
标签: php zend-framework zend-framework2