当前位置: 代码迷 >> PHP >> Zend Framework 配置有关问题
  详细解决方案

Zend Framework 配置有关问题

热度:782   发布时间:2012-03-21 13:33:15.0
Zend Framework 配置问题
PHP code

error_reporting(E_ALL|E_STRICT); 
ini_set('display_errors', 1); 
date_default_timezone_set('Asia/Shanghai'); 
// 目录设置和类装载 
set_include_path('.' . PATH_SEPARATOR . '../library/' 
  . PATH_SEPARATOR . '../application/models/' 
  . PATH_SEPARATOR . '../application/controllers/'  
  . PATH_SEPARATOR . '../application/views/'  
  . PATH_SEPARATOR . get_include_path()); 
include "Zend/Loader/Autoloader.php"; 
Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true); 
// 载入配置文件
$config=new Zend_Config_Ini('../application/config.ini','general');
$registry=Zend_Registry::getInstance();
$registry->set('config',$config);
//设置数据库
$db=Zend_Db::factory($config->db);
Zend_Db_Table::setDefaultAdapter($db);
//设置控制器
$frontController = Zend_Controller_Front::getInstance(); 
$frontController->setBaseUrl('F:/PHP/Source/BookSystem/BookSystem/html');
$frontController->throwExceptions(true); 
$frontController->setControllerDirectory('../application/controllers');
Zend_Layout::startMvc(array('layoutPath'=>'../application/layouts')); 
// run! 
$frontController->dispatch(); 


上面的代码:始终提示错误:
Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (Index.php)' in F:\PHP\Source\BookSystem\BookSystem\library\Zend\Controller\Dispatcher\Standard.php:248 Stack trace: #0 F:\PHP\Source\BookSystem\BookSystem\library\Zend\Controller\Front.php(955): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 F:\PHP\Source\BookSystem\BookSystem\html\index.php(28): Zend_Controller_Front->dispatch() #2 {main} thrown in F:\PHP\Source\BookSystem\BookSystem\library\Zend\Controller\Dispatcher\Standard.php on line 248

求各位大侠!

------解决方案--------------------
你这个配置太落后了。。

不知你的是什么版本的,如果是 1.10 以上的,可以去官网下载个 quily start 。直接通用了
  相关解决方案