1
なぜ私は次のクラスからオブジェクトを作ることができないのか分かりません。 私が得ているエラーは:Vimeoオブジェクトの作り方は?
"Class 'Vimeo' not found"です。
私が間違っている場所について誰かに助言してもらえますか?
マイPHP:
require_once('Vimeo/Vimeo.php');
$client_id = '1234';
$client_secret = 'abcd';
$vimeo = new Vimeo($client_id, $client_secret, $access_token = null);
Vimeoのクラス:
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
);
}