我找到了一些与这个问题密切相关的答案,但我仍然无法解决它。我相信人们会说我的包含路径不正确,但我已经尝试了所有我能找到的解决方案,但无济于事。
这是错误:
Fatal error: Class 'Zend_Controller_Action' not found in /Users/*me*/Sites/*site*/application/controllers/IndexController.php on line 3
这是包含语句:
$newIncludePath = array();
$newIncludePath[] = '.';
$newIncludePath[] = 'include';
$newIncludePath[] = get_include_path();
$newIncludePath[] = '../library';
$newIncludePath[] = '../application/classes/';
$newIncludePath[] = '../application/models/';
$newIncludePath[] = '../application/models/';
$newIncludePath[] = '../application/controllers';
$newIncludePath = implode(PATH_SEPARATOR, $newIncludePath);
set_include_path($newIncludePath);
require_once 'Zend/Controller/Front.php';
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();
几个小时以来,我一直在用键盘敲击论坛。我是zend和php的新手。这东西让我很头疼。我已将控制器明确添加到路径中。我不知道我在忽略什么。
顺便说一句,出于隐私原因,我和网站是经过编辑的名称。
我永远感激一个决议。
mjs-编辑:
我注意到我的包含有点不稳定。所以这里是一个重做:
$newIncludePath = array();
$newIncludePath[] = '.';
$newIncludePath[] = get_include_path();
$newIncludePath[] = '../library';
$newIncludePath[] = '../application/classes/';
$newIncludePath[] = '../application/models/';
$newIncludePath[] = '../application/library/';
$newIncludePath = implode(PATH_SEPARATOR, $newIncludePath);
set_include_path($newIncludePath);
var_dump 的输出:
string(148) "../application/controllers:.:.:/Applications/MAMP/bin/php5/lib/php:../library:../application/classes/:../application/models/:../application/library/"
我注意到 Zend/Controller/Action 存在于 ../library 下。所以,我不明白为什么应用程序找不到它。
如果我从 PHPDebug 运行 IndexController,它会返回
string(170) ".:/Users/me/Sites/site:/Applications/Zend/Zend Studio - 7.1.0/plugins/org.zend.php.framework.resource_7.1.0.v20091101-1523/resources/ZendFramework-1/library/"
Fatal error: Class 'Zend_Controller_Action' not found in /Users/me/Sites/site/application/controllers/IndexController.php on line 5