首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何制作Vimeo对象?

如何制作Vimeo对象?
EN

Stack Overflow用户
提问于 2016-10-01 08:34:49
回答 1查看 619关注 0票数 1

我不知道为什么不能从下面的类生成一个对象。我得到的错误是:

“没有找到'Vimeo‘类”。

有人能告诉我我哪里出了问题吗?

我的php:

代码语言:javascript
复制
require_once('Vimeo/Vimeo.php');

$client_id = '1234';
$client_secret = 'abcd';

$vimeo = new Vimeo($client_id, $client_secret, $access_token = null);

Vimeo级:

代码语言:javascript
复制
 namespace Vimeo;

use Vimeo\Exceptions\VimeoUploadException;
use Vimeo\Exceptions\VimeoRequestException;

 class Vimeo
{
const ROOT_ENDPOINT = 'https://api.vimeo.com';
const AUTH_ENDPOINT = 'https://api.vimeo.com/oauth/authorize';
const ACCESS_TOKEN_ENDPOINT = '/oauth/access_token';
const CLIENT_CREDENTIALS_TOKEN_ENDPOINT = '/oauth/authorize/client';
const REPLACE_ENDPOINT = '/files';
const VERSION_STRING = 'application/vnd.vimeo.*+json; version=3.2';
const USER_AGENT = 'vimeo.php 1.0; (http://developer.vimeo.com/api/docs)';
const CERTIFICATE_PATH = '/certificates/vimeo-api.pem';

private $_client_id = null;
private $_client_secret = null;
private $_access_token = null;

protected $_curl_opts = array();
protected $CURL_DEFAULTS = array();

/**
 * Creates the Vimeo library, and tracks the client and token information.
 *
 * @param string $client_id Your applications client id. Can be found on developer.vimeo.com/apps
 * @param string $client_secret Your applications client secret. Can be found on developer.vimeo.com/apps
 * @param string $access_token Your applications client id. Can be found on developer.vimeo.com/apps or generated using OAuth 2.
 */
public function __construct($client_id, $client_secret, $access_token = null)
{
    $this->_client_id = $client_id;
    $this->_client_secret = $client_secret;
    $this->_access_token = $access_token;
    $this->CURL_DEFAULTS = array(
        CURLOPT_HEADER => 1,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_SSL_VERIFYPEER => true,
        //Certificate must indicate that the server is the server to which you meant to connect.
        CURLOPT_SSL_VERIFYHOST => 2,
        CURLOPT_CAINFO => realpath(__DIR__ .'/../..') . self::CERTIFICATE_PATH
    );
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-10-01 10:59:57

尝试:new Vimeo\Vimeo(...),我的意思是,无论你在哪里使用Vimeo类,你都应该说Vimeo\Vimeo

这是因为php命名空间。你可以在谷歌上搜索更多信息。

希望它能成功!

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

https://stackoverflow.com/questions/39804574

复制
相关文章

相似问题

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