2013-07-22 73 views
1

模型aplication /模型/ newsModel.phpZend框架錯誤類 'models_News' 未找到

class models_newsModel extends Zend_Db_Table_Abstract{ 
} 

控制器在應用\控制器\ LoginController.php

我嘗試創建對象到模型

$this->news = new models_newsModel(); 

,並得到錯誤:*類 'models_newsModel' 未發現在C:\ WAMP \ WWW \ SISTEM一\程序\控制器\ LoginController.php第27行*

也許問題出在我的application.ini

[production] 
phpSettings.display_startup_errors = 1 
phpSettings.display_errors = 1 
bootstrap.path = APPLICATION_PATH "/Bootstrap.php" 
bootstrap.class = "Bootstrap" 
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" 
; ADD THE FOLLOWING LINES 
;resources.layout.layout = "layout" 
;resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts" 

[staging : production] 

[testing : production] 
phpSettings.display_startup_errors = 1 
phpSettings.display_errors = 1 

[development : production] 
phpSettings.display_startup_errors = 1 
phpSettings.display_errors = 1 

回答

1

你創建資源加載器? 您可以在引導初始化:

protected function _initAppAutoload() 
{ 
    $resourceLoader = new Zend_Loader_Autoloader_Resource(array(
     'namespace' => '', 
     'basePath' => APPLICATION_PATH));  
} 

默認情況下,預計模型下進行保存:application/models/並命名爲你的情況Model_*Model_News。但是,如果您想要,您可以使用addResourceType方法更改模型位置和命名方案。閱讀更多here