我的模型目录中有一个单例类,我必须在 Controller 类中使用它的功能。通过 require_once('file path'); 并调用函数作为 ClassName::FunctionName() 工作正常,但我需要使用 Zend Autoloader 而不是通过 require_once 包含类。我在 stackoverflow 上遇到了许多解决方案,这些解决方案使用 bootstrap.php 来添加以下代码,它似乎与 require_once('file path'); 一样。在控制器中做了
protected function _initAutoload()
{
Zend_Loader_Autoloader::getInstance();
}
这样做我得到致命错误:在 {line no.} 上的 {path}\controllers\SampleController.php 中找不到 Class 'ClassName' 我确定我遗漏了一些东西,但无法弄清楚到底是什么。