【发布时间】:2011-12-09 02:23:35
【问题描述】:
我正在尝试将this amazing calendar 集成到我的项目中。我在服务方面遇到了麻烦。我正在使用这种结构:
application/
modules/
agenda/
controllers/
CalendarController.php
models/
services/
CalendarService.php
views/
filters/
helpers/
scripts/
calendar/
view-calendar.php
module2/
module3/
我以这种方式在我的 application.ini 中路由它:
resources.router.routes.agenda.route = /apps/agenda/
resources.router.routes.agenda.defaults.module = agenda
resources.router.routes.agenda.defaults.controller = calendar
resources.router.routes.agenda.defaults.action = view
我打开浏览器,我收到了这条消息:
Message: Invalid controller class ("Agenda_CalendarController")
我用我的 Agenda_ 后缀修复了它并刷新了我的浏览器。得到这个:
Message: Controller "Agenda_CalendarController" is not an instance of Zend_Controller_Action_Interface
所以我用“扩展 Zend_Controller_Action”来实例化它。得到这个::-)
Fatal error: Class 'Service_Calendar' not found in /home/[PATH TO MY APP FOLDER]/application/modules/agenda/controllers/CalendarController.php on line 30
我不知道出了什么问题。有人给我一两个提示:-)
注意:我不知道这是否意味着什么,但我使用的是 NetBeans,如果我在将服务类方法悬停在控制器类中时按下 CTRL;相关弹窗信息正确。
解决方案: 谢谢你们,你们给了我更进一步的道路。我的模块引导设置不正确。根据您的提示,我从 Bob Allen 那里找到了这篇文章,他在其中描述了同样的问题。
当您知道要搜索什么时... :-)
谢谢,我的问题已经解决了,我知道的更多了!
【问题讨论】:
-
尝试将
application/modules/agenda/services/CalendarService.php移动到application/services/Calendar.php,看看是否有运气找到课程。您可能需要使用您的应用程序命名空间(例如 Application_Service_Calendar)重命名该类。
标签: php oop zend-framework class zend-framework-mvc