Zend Tool 未找到扩展 Zend_Controller_Action 的类
我创建了 Zend_Controller_Action 的类扩展,并添加了一些用户定义的方法,这些方法可以从任何控制器等进行访问。
一切都工作正常,直到我使用 Zend Tool 创建一个新的 Action,因为这次 Zend 工具将找不到我的扩展类。
错误信息:
致命错误:在...中找不到类“CMS_Zend_Controller_Action”
这是扩展 Zend_Controller_Action
的类,也是由 indexController
等其他控制器扩展的类。
如何使班级可被发现。我是否必须像我的课程一样包含每个文件夹? zend有这个功能吗?我不这么认为。它是如何做到的?
I created an class extension of Zend_Controller_Action
and added some user defined methods, which will be accessed from any controller so forth.
Every thing is working fine, until I use Zend Tool to create a new Action, as this time The Zend tool will not find out my extended class.
Error Message:
Fatal error: Class 'CMS_Zend_Controller_Action' not found in....
That is the class which extends Zend_Controller_Action
and the one extended by other controllers like indexController
.
How to make the class discoverable. Do I have to include each and every folders, like my classes are? Does zend does that? I dont think so. How does it do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
简单的。 :-p 如果它可以找到您的核心控制器,那么您只需包含扩展控制器的路径即可。
http://php.net/manual/en/function.set-include -path.php
set_include_path(path_to_your_extended_classes)
在你的index.php中,又名路由文件。Simple. :-p If it can find your core controllers, then you just need to include the path to your extended controllers.
http://php.net/manual/en/function.set-include-path.php
set_include_path(path_to_your_extended_classes)
in your index.php, aka routes file.我认为你在这里尝试的不是 Zend_Tool 的目的。
据我了解您的问题和设置,您已经在图书馆中创建了一个课程。当然,您可以在您自己的库中使用许多您自己的类来扩展 Zend_Controller_Action (我也这样做)。向这样的类添加操作可能不寻常,但由于一个特定原因,这对于 Zend_Tool 来说是一个问题。
我相信 Zend_Tool 仅涉及众所周知的结构,例如
/application
以及/modules
内部的内容。如果您创建一个控制器类,Zend_Tool 将为您做一些工作,例如将所需的文件夹结构添加到您的/application
或/modules
文件夹中。与需要查看文件的操作方法相同。在您的库中拥有一个控制器类不需要(不应该)需要所有这些,因此不会构建到 Zend_Tool 中。我认为 Zend_Tool 不支持您在库中创建的任何类。I think what you are trying here is not what Zend_Tool is about.
As much as I understand your question and setup you have created a class in your library. Of course, you can extend Zend_Controller_Action with lots of your own classes in your own library/libraries (I do that, too). Adding an action to such a class is maybe unusual but a problem for Zend_Tool for one specific reason.
Zend_Tool I believe is only about the well known structures like
/application
and same for what is inside/modules
. If you create a Controller Class Zend_Tool will do some work for you like adding required folder structure to your/application
or/modules
folder. Same with action method which require view files. Having a Controller Class in your library does not (should not) need all that and hence is not build into Zend_Tool. I think whatever class you create in your library is not supported in Zend_Tool.