时间:2021-07-01 10:21:17 帮助过:25人阅读
setFallbackAutoloader(true); //静态载入自动类文件 $registry = Zend_Registry::getInstance(); //静态获得实例 $view = new Zend_View(); //实例化zend 模板 $view->setScriptPath('./application/views/web/');//设置模板显示路径 $registry['view'] = $view;//注册View //配置数据库参数,并连接数据库 $config=new Zend_Config_Ini('./application/config/config.ini',null, true); Zend_Registry::set('config',$config); $dbAdapter=Zend_Db::factory($config->general->db->adapter,$config->general->db->config->toArray()); $dbAdapter->query('SET NAMES UTF8'); Zend_Db_Table::setDefaultAdapter($dbAdapter); Zend_Registry::set('dbAdapter',$dbAdapter); //数据库结束 //设置控制器 $frontController =Zend_Controller_Front::getInstance(); $frontController->setBaseUrl('/mvc')//设置基本路径 mvc换成你项目的路径 ->setParam('noViewRenderer', true) ->setControllerDirectory('./application/controllers') ->throwExceptions(true) ->dispatch(); ?>