<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->
zf-demo
application
controller
IndexController.php
models
User.php
services
views
Bootstrap.php
Copy after login
其中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;
}
}
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn