欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

php之ZendFramewor篇(2)zf+samrty index.php 配置

程序员文章站 2022-06-08 21:25:40
...
php之ZendFramewor篇(二)zf+samrty index.php 配置
	setFallbackAutoloader ( true );$registry = Zend_Registry::getInstance ();$config = new Zend_Config_Ini ( '../application/configs/application.ini', null, true );Zend_Registry::set ( 'config', $config );$dbAdapter = Zend_Db::factory ( $config->database->db->adapter, $config->database->db->config->toArray () );$dbAdapter->query ( 'SET names utf8' );Zend_Db_Table::setDefaultAdapter ( $dbAdapter );Zend_Registry::set ( 'db', $dbAdapter );require_once 'Zend/Log.php';require_once 'Zend/Log/Writer/Stream.php';$logger = new Zend_Log ( new Zend_Log_Writer_Stream ( '.' . $config->log->logger->path, 'a+' ) );Zend_Registry::set ( 'logger', $logger );$view = new Zend_View ();$view->setScriptPath ( './templates/' );$view->setHelperPath('./templates/helpers', 'Zend_View_Helper');$registry ['view'] = $view;include_once ("../library/Smarty/Smarty.class.php");$smarty = new Smarty ();$smarty->caching = false;$smarty->template_dir = "./templates/";$smarty->compile_dir = "./data/smarty/";$smarty->cache_dir = "./data/smarty/cache_c/";//$smarty->left_delimiter = "right_delimiter = "}>";$registry = Zend_Registry::getInstance ();$registry->set ( 'smarty', $smarty );$front = Zend_Controller_Front::getInstance ();$front->setBaseUrl ( '/' );$front->setParam ( 'useDefaultControllerAlways', true );$front->setParam ( 'noViewRenderer', true );$front->setControllerDirectory ( '../application/controllers' );$front->throwExceptions ( true );Zend_Session::start();require_once 'Zend/Application.php';$application = new Zend_Application ( APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini' );$application->bootstrap ()->run ();?>
php之ZendFramewor篇(2)zf+samrty index.php 配置

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。

相关文章

相关视频