0
bootstrap.php中找不到類
define('ROOT_DIR', dirname(__FILE__));
require_once('Zend/Controller/Front.php');
$front = Zend_Controller_Front::getInstance();
$front->addModuleDirectory(ROOT_DIR . '/application/modules');
$front->dispatch();
應用/模塊/控制器/ IndexController.php
class IndexController extends Zend_Controller_Action {
public function indexAction() {
require_once(ROOT_DIR . '/application/models/DbTable/Users.php');
$users = new Application_Model_DbTable_Users();
}
}
應用/模型/ DBTABLE/Users.php
class Application_Model_DbTable_Users extends Zend_Db_Table_Abstract
{
protected $_name = 'users';
}
錯誤消息:
Fatal error: Class 'Zend_Db_Table_Abstract' not found in /var/www/projects/forum4php/application/models/DbTable/Users.php on line 4 Call Stack: 0.0026 330996
1. {main}() /var/www/projects/forum4php/bootstrap.php:0 0.0149 1128036
2. Zend_Controller_Front->dispatch(???, ???) /var/www/projects/forum4php/bootstrap.php:11 0.0326 2499724
3. Zend_Controller_Dispatcher_Standard->dispatch(???, ???) /var/www/projects/zendframework/Zend/Controller/Front.php:954 0.0416 2810512
4. Zend_Controller_Action->dispatch(???) /var/www/projects/zendframework/Zend/Controller/Dispatcher/Standard.php:295 0.0418 2814860
5. IndexController->indexAction() /var/www/projects/zendframework/Zend/Controller/Action.php:513 0.0419 2817108
6. require_once('/var/www/projects/forum4php/application/models/DbTable/Users.php') /var/www/projects/forum4php/application/modules/default/controllers/IndexController.php:4
如何讓Zend Framework看到應用程序模型DbTable用戶?
更新:
require_once(ROOT_DIR . '/application/models/DbTable/Users.php');
require_once('Zend/Db/Table/Abstract.php');
class IndexController extends Zend_Controller_Action {
public function indexAction() {
$users = new Application_Model_DbTable_Users();
}
}
錯誤消息:
Fatal error: Class 'Zend_Db_Table_Abstract' not found in /var/www/projects/forum4php/application/models/DbTable/Users.php on line 3 Call Stack: 0.0024 331316
1. {main}() /var/www/projects/forum4php/bootstrap.php:0 0.0160 1128364
2. Zend_Controller_Front->dispatch(???, ???) /var/www/projects/forum4php/bootstrap.php:11 0.0360 2500024
3. Zend_Controller_Dispatcher_Standard->dispatch(???, ???) /var/www/projects/zendframework/Zend/Controller/Front.php:954 0.0368 2500108
4. Zend_Controller_Dispatcher_Standard->loadClass(???) /var/www/projects/zendframework/Zend/Controller/Dispatcher/Standard.php:262 0.0372 2514700
5. include_once('/var/www/projects/forum4php/application/modules/default/controllers/IndexController.php') /var/www/projects/zendframework/Zend/Controller/Dispatcher/Standard.php:344 0.0373 2516956
6. require_once('/var/www/projects/forum4php/application/models/DbTable/Users.php') /var/www/projects/forum4php/application/modules/default/controllers/IndexController.php:2
它仍然無法看到模型...
更新:
require_once('Zend/Db/Table/Abstract.php');
class Application_Model_DbTable_Users extends Zend_Db_Table_Abstract
{
protected $_name = 'users';
}
Invalid controller specified (error)
#0 /var/www/projects/zendframework/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#1 /var/www/projects/forum4php/bootstrap.php(11): Zend_Controller_Front->dispatch()
#2 {main}
它仍然無法看到模型...
我試過要求。看看更新。 – 2010-11-27 13:13:32