+ -
当前位置:首页 → 问答吧 → 懂zendframework框架的进来

懂zendframework框架的进来

时间:2010-09-17

来源:互联网

<?php
error_reporting(E_ALL|E_STRICT); //在开启错误报告

date_default_timezone_set('Asia/Shanghai'); //配置地区

set_include_path('.' .PATH_SEPARATOR .'./lib'.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/scripts/');//设置模板显示路径
$registry['view'] = $view;//注册View

//使用smarty
    include_once"lib/smarty/Smarty.class.php";

    $smarty = new Smarty();
    $smarty->left_delimiter = "{";
    $smarty->right_delimiter = "}";
    $smarty->template_dir = 'application/views/scripts';
    $smarty->compile_dir = 'application/views/templates_c';
    $smarty->cache_dir = 'application/views/cache';
  
    function smarty_block_dynamic($param,$content,&$smarty)
    {
        return $content;
    }
    $smarty->register_block('dynamic','smarty_block_dynamic',false);
    Zend_Registry::set('smarty', $smarty);

    //  设置数据库连接
$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('/zendeg123')//设置基本路径,这里面是你的项目的名字
     ->setParam('noViewRenderer', true)
     ->setControllerDirectory('./application/controllers')
     ->throwExceptions(true)
     ->dispatch();  
?>

这个是报错误Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (index.php)' in E:\wamp\www\zendeg123\lib\Zend\Controller\Dispatcher\Standard.php:242 Stack trace: #0 E:\wamp\www\zendeg123\lib\Zend\Controller\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 E:\wamp\www\zendeg123\index.php(48): Zend_Controller_Front->dispatch() #2 {main} thrown in E:\wamp\www\zendeg123\lib\Zend\Controller\Dispatcher\Standard.php on line 242
这个是什么原因啊

作者: hihily   发布时间: 2010-09-17

这个是我文件结构 数据库我配置好了 不知道什么原因
图片:2.jpg
'700')this.width='700';if(this.offsetHeight>'700')this.height='700';" title="Click Here To EnLarge">

作者: hihily   发布时间: 2010-09-17

怎么没人过顶一下啊 晕啊 啊 啊啊啊啊啊啊啊啊啊

作者: hihily   发布时间: 2010-09-17

相关阅读 更多

热门下载

更多