doutangdan3588 2014-06-27 15:21
浏览 72

Zf2致命错误:找不到类'BookList \ Controller \ BookController'

I'me developing an app in zf2. when I define routes in module.config.php and access them in my browser, php throws error :

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

here is my 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'
        )
    )

I have my BookController namespaced BookList\src\BookList\Controller

  • 写回答

2条回答 默认 最新

  • doupeng6890 2014-06-27 15:24
    关注

    You should not specify the path, but only the class name, e.g. remove \BookList\src\ part. The namespace also should not container the src folder

    评论

报告相同问题?

悬赏问题

  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计