求!求!求! Zend_framework解决方案

WBOY
Release: 2016-06-13 13:41:14
Original
671 people have browsed it

求!求!求! Zend_framework
求 Zend_framework 的配置教程 。。

请高人们发一个你们使用过的配置教程

------解决方案--------------------

PHP code

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();
?> 
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!