我發現一些與此問題密切相關的答案,但仍無法解決。 我相信人們說我的包含路徑有些不正確,但我嘗試了所有我無法找到的解決方案。致命錯誤:未找到'Zend_Controller_Action'類
這裏的錯誤:
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的新手。這東西給了我一個皇室頭痛。我明確地將控制器添加到路徑中。我不知道我在忽略什麼。
btw,me和網站是出於隱私原因的編輯名稱。
我對解決方案永遠感激不盡。
mjs-edit:
我注意到我的包括有點不吉利。因此,這裏是一個做了:
$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/"
我注意到,在../library存在的Zend /控制器/動作。所以,我不明白爲什麼應用程序找不到它。
如果我從PHPDebug運行索引控制器,它返回
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
我一直現在我已經爲這個問題敲了兩天頭,我覺得我沒有接近解決方案。希望有人能提供比我現在更多的洞察力。 謝謝。 – 2009-12-15 02:28:35