首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >找不到类'TusPhp\Tus\Client‘

找不到类'TusPhp\Tus\Client‘
EN

Stack Overflow用户
提问于 2019-08-31 06:12:23
回答 1查看 996关注 0票数 2

我正在使用PHP中的vimeo-api库,当我上传文件时,它给我这个错误。我不知道为什么这个错误会出现在我身上,请看看这个,让我知道为什么这个错误是常见的错误:类'TusPhp\Tus\Client‘找不到这里是我的代码

代码语言:javascript
复制
<?php
use Vimeo\Vimeo;
use Vimeo\Exceptions\VimeoUploadException;
/**
 *   Copyright 2013 Vimeo
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */
$config = require(__DIR__ . '/init.php');
if (empty($config['access_token'])) {
    throw new Exception(
        'You can not upload a file without an access token. You can find this token on your app page, or generate ' .
        'one using `auth.php`.'
    );
}
// Instantiate the library with your client id, secret and access token (pulled from dev site)
$lib = new Vimeo($config['client_id'], $config['client_secret'], $config['access_token']);
// Create a variable with a hard coded path to your file system
$file_name = "C:\Users\BASIT\Downloads\SampleVideo_1280x720_1mb.mp4";
echo 'Uploading: ' . $file_name . "\n";
try {
    // Upload the file and include the video title and description.
    $uri = $lib->upload($file_name, array(
        'name' => 'Vimeo API SDK test upload',
        'description' => "This video was uploaded through the Vimeo API's PHP SDK."
    ));
    // Get the metadata response from the upload and log out the Vimeo.com url
    $video_data = $lib->request($uri . '?fields=link');
    echo '"' . $file_name . ' has been uploaded to ' . $video_data['body']['link'] . "\n";
    // Make an API call to edit the title and description of the video.
    $lib->request($uri, array(
        'name' => 'Vimeo API SDK test edit',
        'description' => "This video was edited through the Vimeo API's PHP SDK.",
    ), 'PATCH');
    echo 'The title and description for ' . $uri . ' has been edited.' . "\n";
    // Make an API call to see if the video is finished transcoding.
    $video_data = $lib->request($uri . '?fields=transcode.status');
    echo 'The transcode status for ' . $uri . ' is: ' . $video_data['body']['transcode']['status'] . "\n";
} catch (VimeoUploadException $e) {
    // We may have had an error. We can't resolve it here necessarily, so report it to the user.
    echo 'Error uploading ' . $file_name . "\n";
    echo 'Server reported: ' . $e->getMessage() . "\n";
} catch (VimeoRequestException $e) {
    echo 'There was an error making the request.' . "\n";
    echo 'Server reported: ' . $e->getMessage() . "\n";
}
EN

回答 1

Stack Overflow用户

发布于 2020-05-08 18:42:05

您好,如果您使用框架php,如codeigniter,那么您还可以在自动加载文件中声明,并且您的路径$file_name = "C:\Users\BASIT\Downloads\SampleVideo_1280x720_1mb.mp4";不工作,只需应用单引号,则它可以正常工作。

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57733709

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档