【发布时间】:2015-09-10 18:42:03
【问题描述】:
我已将我的 Zend Framework 应用程序移植到不同的服务器。这是一个 Zend Framework 应用程序版本2.3.*
现在访问此网址http://calendar.app/calendar 时出现以下错误:
Fatal error: Class 'Calendar\Controller\CalendarController' not found in /home/vagrant/Code/calendar/vendor/zendframework/zendframework/library/Zend/ServiceManager/AbstractPluginManager.php on line 170
我的 CalendarControler 位于我的日历模块中,该模块的加载方式类似于
return array(
'controllers' => array(
'invokables' => array(
'Calendar' => 'Calendar\Controller\CalendarController',
),
),
'router' => array(
'routes' => array(
'calendar' => array(
'type' => 'Literal',
'options' => array(
'route' => '/calendar',
'defaults' => array(
'controller' => 'calendar',
'action' => 'index',
),
),
),
),
),
'view_manager' => array(
'template_path_stack' => array(
__DIR__ . '/../view',
),
),
);
我试过了
composer clear-cache
composer dump-autoload
但这没有帮助。 我该如何解决这个问题。
【问题讨论】:
-
Calendar\Controller\CalendarController 的斜线方向是否正确?我认为你需要提供整个路径
-
此错误似乎表明以下三件事之一——要么您的路径中没有名为
Calendar/Controller/CalendarController.php的文件,要么您拥有该文件,但其中定义的类名没有匹配,或者您还没有注册自动加载器。
标签: php zend-framework nginx ubuntu-14.04