Zend_Loader 找不到我的文件?
我正在关注 Zend Forms 上的本教程。 我逐字复制它并收到此错误
致命错误:在第 10 行 /Quickstart/application/controllers/IndexController.php 中找不到类“forms_ContactForm”
这让我相信它没有在类中加载,所以我将其添加到我的 IndexController.php 文件中
Zend_Loader::loadClass('forms_ContactForm');
这是我收到的主要错误,我相信这是因为它无法找到我的 form_ContactForm.php 文件,我不确定为什么。
这是我的文件夹层次结构:
快速开始
应用
控制器
表格
布局
观点
图书馆
公共
完整错误文本的链接
任何帮助,我们将不胜感激,
列维
I am following this tutorial on Zend Forms. I copied it verbatim and I got this error
Fatal error: Class 'forms_ContactForm' not found in /Quickstart/application/controllers/IndexController.php on line 10
Which led me to believe it wasn't loading in the class, so I added this into my IndexController.php file
Zend_Loader::loadClass('forms_ContactForm');
This is the main error I am receiving, I believe it is because it cannot locate my form_ContactForm.php file and I am unsure why.
This is my hierarchy of folders:
Quickstart
application
controllers
forms
layouts
views
library
public
link to full error text
Any help would be appreciated,
Levi
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的包含路径设置为:
由于您的“forms”文件夹不直接位于上述任何包含路径下,因此 include 命令将不起作用。
要解决此问题,请将 /application/ 目录添加到包含路径中,然后重试。
Your include path is set to:
Since your "forms" folder is not directly under any of the above include paths that include command won't work.
To fix this, add the /application/ directory to your include path and try again.
正如 Shane 所说,您应该在包含路径中包含“应用程序”文件夹。 这应该在您的“index.php”引导文件中完成:
此外,您可以通过将其添加到您的引导文件来告诉 Zend Framework 自动加载所有类:
这将使您不必手动加载您使用的每个类。
As Shane said, you should include your "application" folder in your include path. This should be done in your "index.php" bootstrap file :
Moreover, you can tell Zend Framework to autoload all classes by adding this to your bootstrap file :
This will save you from having to load manuall each class you use.