<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->
zf-demo
application
controller
IndexController.php
models
User.php
services
views
Bootstrap.php
Nach dem Login kopieren
其中user.php的类名是Model_User,在IndexController.php中有这么一句调用$user = new Model_User(); 执行时会报错 Fatal error: Class 'Model_User' not found in D:\lamp\sites\zf-demo\application\controllers\IndexController.php on line 132 上网搜索后得到答案 在Bootstarp.php中加入_initAutoload方法 Bootstrap.php代码
PHP code
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->
<?php class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
protected function _initAutoload() {
$moduleLoader = new Zend_Application_Module_Autoloader(array(
'namespace' => '',
'basePath' => APPLICATION_PATH));
/** auto load */
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->setFallbackAutoloader(true);
return $moduleLoader;
}
}
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn