Yii 的 Dropbox [英] Dropbox for Yii

查看:39
本文介绍了Yii 的 Dropbox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道如何绑定 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

这篇关于Yii 的 Dropbox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆