日期:2014-05-17 浏览次数:37314 次
Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (error)' in C:\php\library\Zend\Controller\Dispatcher\Standard.php:241 Stack trace: #0 C:\php\library\Zend\Controller\Front.php(934): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 G:\WEB\php\Z\index.php(36): Zend_Controller_Front->dispatch() #2 {main} thrown in C:\php\library\Zend\Controller\Dispatcher\Standard.php on line 241
<?php
/*
*
*Zend Framework
*
*/
//require_once 'Zend/Controller/Front.php';
// $rootPath = dirname(dirname(__FILE__));
//Zend_Controller_Front::run($rootPath . '/z/application/controllers');
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.php';
Zend_Loader::registerAutoload();//设置Zend Framework 自动载入类文件
$registry = Zend_Registry::getInstance();
$view = new Zend_View();
$view->setScriptPath('./application/views/scripts/index/');//设置模板显示路径
$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('/z')//设置基本路径
->setParam('noViewRenderer', true)
->setControllerDirectory('./application/controllers')
->throwExceptions(False)
->dispatch();
$frontCtrl->throwExceptions(true);// true 为抛出异常,false 为不抛出
$frontCtrl->setParam('useDefaultControllerAlways', true); // true 为 404 总是重定向到默认控制器
$this->_frontCtrl->registerPlugin(
new Zend_Controller_Plugin_ErrorHandler(array('module'=>'error', 'controller'=>'error', 'action'=>'error'))
);