【发布时间】:2023-03-07 16:36:01
【问题描述】:
我找到了一些与此问题密切相关的答案,但我仍然无法解决。 我相信人们会说我的包含路径不正确,但我已经尝试了所有我能找到的解决方案,但无济于事。
这是错误:
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的新手。这东西让我很头疼。我已将控制器明确添加到路径中。我不知道我忽略了什么。
顺便说一句,出于隐私原因,me 和 site 是经过编辑的名称。
我永远感激解决方案。
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
【问题讨论】:
-
我这两天一直在努力解决这个问题,但我觉得我离解决方案还差得远。希望有人可以提供比我现在更多的见解。谢谢。
标签: php zend-framework fatal-error include-path