简体   繁体   English

致命错误:找不到类'OpenCloud \\ Rackspace'

[英]Fatal error: Class 'OpenCloud\Rackspace' not found

For a custom application, I am trying to integrate Rackspace cloud files using php-opencloud library. 对于自定义应用程序,我正在尝试使用php-opencloud库集成Rackspace云文件。

This is the link I followed for setup - https://github.com/srijanaravali/php-opencloud/blob/master/docs/getting-started.md 这是我遵循的设置链接-https: //github.com/srijanaravali/php-opencloud/blob/master/docs/getting-started.md

# Install Composer
curl -sS https://getcomposer.org/installer | php

# Require php-opencloud as a dependency
php composer.phar require rackspace/php-opencloud:dev-master

However, when I try to instantiate a client object, it throws an error: 但是,当我尝试实例化客户端对象时,它将引发错误:

Fatal error: Class 'OpenCloud\Rackspace' not found in /var/www/example/Project/sites/all/libraries/php-opencloud/test.php on line 7

Here is the code snippet: 这是代码片段:

<?php

require 'vendor/autoload.php';
use OpenCloud\Rackspace;

// 1. Instantiate a Rackspace client.
$client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array(
    'username' => getenv('Axxxxxxx'),
    'apiKey'   => getenv('abcxxxxxxxxxxxxxxxxxxxx')
));

print_r($client); die('!!');

Any pointers about whats missing? 关于缺少什么的任何指示?

Got it working. 得到它的工作。 For some strange reason, php-opencloud library was empty under vendors/rackspace/php-opencloud . 由于某些奇怪的原因,php-opencloud库在vendors/rackspace/php-opencloud下为空。

Cloned one from github and created a symlink to it from above directory. 从github克隆了一个,并从上面的目录创建了一个符号链接。 It is working fine now. 现在工作正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM