duanfengshang1088 2019-02-01 22:26
浏览 89
已采纳

作曲家找不到类并加载它们

I am using a Dropbox api package and installed it with Composer.When I try to use classes that gives me a fatal error that can not find classes.

This is my composer.json

{
    "require": {
        "kunalvarma05/dropbox-php-sdk": "^0.2.1"
    }
}

This is my php file

use Kunnu\Dropbox\Dropbox;
use Kunnu\Dropbox\DropboxApp;

$app = new DropboxApp("client_id", "client_", 'access_token');

//Configure Dropbox service
$dropbox = new Dropbox($app);

//Get File Metadata
$fileMetadata = $dropbox->getMetadata("/helloworld.txt");

//File Name
// $fileMetadata->getName();

printf($fileMetadata->getName());

My php version is 7.2.4 and the error is:

Fatal error: Uncaught Error: Class 'Kunnu\Dropbox\DropboxApp' not found in D:\MeHDi\Projects\DropBox Api\Upload.php:6 Stack trace: #0 {main} thrown in D:\MeHDi\Projects\DropBox Api\Upload.php on line 6

  • 写回答

1条回答 默认 最新

  • dongtao5055 2019-02-01 23:36
    关注

    Have you remembered to import composers autoload file using require "path/to/vendor/autoload.php";

    This is required in order to initialize and use the different composer libraries. Remember to change the filepath to where your vendor/autoload.php file is located.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 请问不小心下载到了钓鱼软件怎么办?
  • ¥15 求国博抢票 求国博抢票 有的私
  • ¥50 swiftui @query 报错
  • ¥50 怎么解决刷卡或扫码后,点击软件输入框,win10屏幕键盘不会自动弹出的问题
  • ¥15 如何使用arcgispro的训练深度模型,发现water和nowater精度为0?(相关搜索:深度学习)
  • ¥20 matlab作业不太懂呀有问题能给个代码吗
  • ¥15 自制电路图为何无法驱动ESP01S?
  • ¥15 前端加access数据库
  • ¥15 ARCGIS 多值提取到点 ERROR 999999
  • ¥15 mysql异常断电, [MY-011971] [InnoDB]