Yii 的 Dropbox

2022-01-04 00:00:00 dropbox php yii

有谁知道如何绑定 dropbox php api http://code.google.com/p/dropbox-php/ 在 Yii 中.我下载了源文件并放入 ext.dropbox 然后插入以下代码

Has anyone any idea how to tie in the dropbox php api http://code.google.com/p/dropbox-php/ in Yii. I downloaded the source files and put in ext.dropbox and then inserted the following code

     $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"类*

I get the error Fatal error: Class 'CExceptionEvent' not found in *

推荐答案

试试这个:

$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 库可供下载以及用于 Dropbox REST API 的 PHP 5.3 SDK

Also there is a API libary for download in this Dropbox Lib and also a PHP 5.3 SDK for the Dropbox REST API

相关文章