2011-07-12 5 views
1

YiiのDropbox php api http://code.google.com/p/dropbox-php/をどのように結びつけるか考えています。私は、ソースファイルをダウンロードし、ext.dropboxに入れ、その後、次のコードを挿入しYiiのDropbox

 $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')); 

私はエラー致命的なエラーが出る: *

答えて

0

、このいずれかを試してみてくださいその他のlibs:

$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'); 

はまた、ダウンロード用のAPI libaryはこのDropbox Lib にありPHP 5.3 SDK for the Dropbox REST API

3

で見つからないクラスのCExceptionEvent」を私はよない、具体的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