2011-07-12 33 views
1

有任何人任何想法如何在Dropbox的PHP API http://code.google.com/p/dropbox-php/配合Yii中。我下載的源文件,並把在ext.dropbox,然後插入下面的代碼的Dropbox爲Yii的

 $dropbox = Yii::getPathOfAlias('ext.dropbox'); 
    spl_autoload_unregister(array('YiiBase','autoload'));  
    Yii::registerAutoloader(array('Dropbox_autoload','autoload')); 
     $consumerKey = '***'; 
     $consumerSecret = '***'; 
     $oauth = new Dropbox_OAuth_PHP($consumerKey, $consumerSecret); 

     try { 
      $oauth = new Dropbox_OAuth_PHP($consumerKey, $consumerSecret); 
      $dropbox = new Dropbox_API($oauth);    
      $info = $dropbox->getMetaData('Files'); 
     } catch (Exception $e) { 
      $error = "error: " . $e->getMessage(); 
     } 

     spl_autoload_register(array('YiiBase','autoload')); 

我得到的錯誤致命錯誤:類「CExceptionEvent」在 *

回答

0

試試這個:

$dropbox = Yii::getPathOfAlias('ext.dropbox'); 
    spl_autoload_unregister(array('YiiBase','autoload'));  
    Yii::registerAutoloader(array('Dropbox_autoload','autoload')); 
     $consumerKey = '***'; 
     $consumerSecret = '***'; 
     $oauth = new Dropbox_OAuth_PHP($consumerKey, $consumerSecret); 

     try { 
      $oauth = new Dropbox_OAuth_PHP($consumerKey, $consumerSecret); 
      $dropbox = new Dropbox_API($oauth);    
      $info = $dropbox->getMetaData('Files'); 
     } catch (Exception $e) { 
      $error = "error: " . $e->getMessage(); 
     } 

     spl_autoload_register(array('YiiBase','autoload')); 

Yii::import('swift.classes.Swift', true); 
Yii::registerAutoloader(array('Swift','autoload')); 
Yii::import('swift.swift_init', true); 

Yii::setPathOfAlias('swift', '/var/www/lib'); 

也有這Dropbox Lib 用於下載的API libary也是一個PHP 5.3 SDK for the Dropbox REST API

3

沒有找到我不知道Dropbox的明確,但是這是我包括SwiftMailer:

Yii::import('swift.classes.Swift', true); 
Yii::registerAutoloader(array('Swift','autoload')); 
Yii::import('swift.swift_init', true); 

其中setPathOfAlias樣子:

Yii::setPathOfAlias('swift', '/var/www/lib'); 

(我使用的是其用於其他應用,這就是爲什麼它是不是在Yii的樹。其他庫我一直在擴展目錄和簡單的,基本的「進口」是往往不夠)

+0

感謝 - 我與你的保持庫中單獨的文件夾,點同意,我將使用它的Yii之外也。我現在會測試這個。再次感謝 – Joe