Zend Framework 配置错误收集---根据个人的实战

Zend Framework 配置错误如下:

Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (index.php)' in F:\Wamp\www\zendframework\library\Zend\Controller\Dispatcher\Standard.php:242 Stack trace: #0 F:\Wamp\www\zendframework\library\Zend\Controller\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 F:\Wamp\www\zendframework\index.php(20): Zend_Controller_Front->dispatch() #2 {main} thrown in F:\Wamp\www\zendframework\library\Zend\Controller\Dispatcher\Standard.php on line 242

Index.php文件:

    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 "library/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

    //设置控制器

    $frontController =Zend_Controller_Front::getInstance();

    $frontController->setBaseUrl('/zendframework')//设置基本路径

                  ->setParam('noViewRenderer'true)

                  ->setParam('useDefaultControllerAlways', true)

                  ->setControllerDirectory('./application/controllers')

                  ->throwExceptions(true)

                  ->dispatch();

产生这样的错误主要是hi以为在index.php入口文件中少了$frontController->setParam('useDefaultControllerAlways', true);加上就可以了


你可能感兴趣的:(php)