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 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化