作曲家不自动加载

2022-01-21 00:00:00 namespaces php composer-php autoload tumblr

我按照作曲家的说明成功安装了作曲家.我想使用 tumblr 全新的 php api 客户端.

I followed the composer instructions and installed composer successfully. I want to use tumblr's brand new php api client.

我的文件夹结构:

vendor/
composer.json
composer.lock
myfile.php

composer.json:

{
    "require": {
        "tumblr/tumblr": "0.0.2"
    }
}

myfile.php:

require 'vendor/autoload.php';
$client = new TumblrAPIClient(CONSUMER_KEY, CONSUMER_SECRET);

使用 php composer.phar install 安装也很有效.但是在执行 myfile.php 时找不到该类.

Installing using php composer.phar install works great as well. But when executing myfile.php the class could not be found.

致命错误:在第 9 行的 [..]/htdocs/tumblr/myfile.php 中找不到类TumblrAPIClient"

Fatal error: Class 'TumblrAPIClient' not found in [..]/htdocs/tumblr/myfile.php on line 9

推荐答案

已经发布了一个新版本的 tumblr.php 来解决这个问题.感谢@igorw.

A new version of tumblr.php has been released which fixes the issue. Thanks to @igorw.

相关文章