其中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
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
protected function _initAutoload() {
$moduleLoader = new Zend_Application_Module_Autoloader(array(
'namespace' => '',
'basePath' => APPLICATION_PATH));