2014-03-06 66 views
0

我正在做一個簡單的網站,必須使用一些數據庫中的表和執行一些web服務任務。沒什麼複雜。我已經從我的根文件夾中的其他項目中獲取配置,並將它們粘貼到配置和引導文件中。該應用程序INI如下:配置錯誤Zend Framework 1.12 application.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; 
    } 
} 

後嗯,這長碼貼我有錯誤,以顯示給你,這deosn't任何意義,我,但我想象,我是sissing的東西(我不使用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

刪除和[開發:生產]再次添加空格

有時會發生意外,一個不換行空格U + 00A0是前或後:然後Zend框架去堅果。例如,在OSX上按alt + space會插入一個非破壞性的空間,你不會注意到它。

相關問題