Home > Article > Backend Development > 求!求!求! Zend_framework解决方案
求!求!求! Zend_framework
求 Zend_framework 的配置教程 。。
请高人们发一个你们使用过的配置教程
------解决方案--------------------
<?php error_reporting(E_ALL|E_STRICT); //在开启错误报告 date_default_timezone_set('Asia/Shanghai'); //配置地区 set_include_path('.' .PATH_SEPARATOR .'./library'.PATH_SEPARATOR .'./application/models/'.PATH_SEPARATOR . get_include_path()); //配置环境路径 require_once "Zend/Loader/Autoloader.php"; //载入zend框架 Zend_Loader_Autoloader::getInstance()->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(); ?> <div class="clear"> </div>