最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
zend 框架配置方法
时间:2022-07-02 10:46:18 编辑:袖梨 来源:一聚教程网
//指明引用文件的路径
set_include_path('.' .
PATH_SEPARATOR . './libary/'. //指定ZEND所在目录
PATH_SEPARATOR . './application/models/'. //指定MODEL所在目录
PATH_SEPARATOR . './libary/smarty/'. //指定smarty模板
PATH_SEPARATOR . get_include_path());
//必须手动加载Loader.php教程
include "Zend/Loader.php";
Zend_Loader::registerAutoload();
//加载数据库教程配置文件
//Zend/Config/Ini.php
$config = new Zend_Config_Ini ('./application/config.ini', 'general');
$registry = Zend_Registry::getInstance();
$registry->set('config', $config);
//加载数据库
$db = Zend_Db::factory ($config->db);
$db->query('set names gbk');
Zend_Db_Table::setDefaultAdapter($db);
//getInstance()方法用来获取前端控制器实例
$frontController = Zend_Controller_Front::getInstance();
//指定模块目录
$frontController->addModuleDirectory('./application');
//加载smarty模板插件
$frontController->registerPlugin(new plugin_MyPlugin());
//Zend布局应用
//$options = array("layout"=>"head","layoutpath"=>"/layouts", 'contentKey' => 'CONTENT');
//$layout = new Zend_Layout($options);
//设置模板后缀名
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
$viewRenderer->setViewSuffix('php');
//抛出异常
$frontController->throwExceptions(true);
//开始运行程序
$frontController->dispatch();
相关文章
- 火影忍者怎么获得大招 05-03
- 星际战甲新手什么刀好 05-03
- 文明6秦始皇金字塔怎么加速 05-03
- 全民奇迹2龙骸巨剑怎么获得 05-03
- 星露谷物语鲟鱼怎么获得 05-03
- 长安幻想怎么转职 05-03