配置错误Zend Framework 1.12 application.ini

时间:2014-03-06 08:49:50

标签: php zend-framework configuration

我正在创建一个简单的网站,它必须使用数据库中的某些表并执行一些Web服务任务。没什么复杂的。我从我的根文件夹中的其他项目中获取了配置,并将它们粘贴到配置和引导程序文件中。应用程序ini如下:

[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
phpSettings.date.timezone = "Europe/Rome"
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"

resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
includePaths.library = APPLICATION_PATH "/../library"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"

;connessione al db
resources.db.adapter = pdo_mssql
resources.db.params.host = "IP"
resources.db.params.username = USER
resources.db.params.password = PWD
resources.db.params.dbname = NAME
resources.db.isDefaultTableAdapter = true
resources.db.params.pdoType = dblib

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
;resources.db.adapter = pdo_mssql

我的引导程序文件如下:

<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    public function _initAutoloader(){
        Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true);
    }

    public function _initDb(){

        $resource = $this->getPluginResource("db");
        $db = $resource->getDbAdapter();
        $db->setFetchMode(Zend_Db::FETCH_OBJ);

        Zend_Db_Table_Abstract::setDefaultAdapter($db);
        Zend_Registry::set("db", $db);
    }
}

在我的控制器中,我正在执行以下操作(当我没有连接到数据库时它正在工作):

class IndexController extends Zend_Controller_Action
{

    public function init()
    {
        $access_token=$this->getFrontController()->getRequest()->getHeader('Authorization');
        if(isset($access_token)){
            $access_token = str_replace ( "Bearer ", "", $access_token);
            $db=Zend_Registry::get("db");
            $token= $db->fetchRow("SELECT * FROM dbo.wsoauth2 WHERE atoken='".$access_token."'");
            if($token!=false){
                //Perform the action required to enter the right app
                $link= $db->fetchRow("SELECT * FROM dbo.wsapp WHERE appid='".$token->app_id);
                header("Authorization: Bearer ".$access_token);
                header("Location: ".$this->getFrontController()->getBaseUrl()."/webservice");
            } else {
                //Let the other stuff from the controller take place
            }
        }
   }

    public function indexAction()
    {
        $appid = $this->getRequest()->getParam('appid');
        $this->view->appid= $appid;
     }
}

在这个长代码粘贴后,我有错误向你显示,这对我来说没有任何意义,但我想象我正在发送一些东西(我不会在很长一段时间内使用zend框架所以它是很明显我是):

 Fatal error: Uncaught exception 'Zend_Config_Exception' with message 'Section 'development' cannot be found in /usr/local/zend/apache2/htdocs/project/application/configs/application.ini'

在第一个代码粘贴中,“开发”部分出现在你眼前。所以我很困惑。有人可以帮忙吗?

1 个答案:

答案 0 :(得分:1)

在[development:production]

中再次删除并添加空格

有时,偶然发生的是非破坏性空间U + 00A0位于前面或之后:然后Zend Framework变得疯狂。例如,在OSX上按下alt + space将插入一个非中断空格,你将不会注意到它。