1

尝试从 et/s/wr.php 运行弹性转换器 php 代码。wr.php 包含 php 转码器代码。这是我的代码。

<?php
require 'vendor/autoload.php';
use Aws\ElasticTranscoder\ElasticTranscoderClient;
-------------
------------

?>

这是我从 loaclhost 运行时的错误。

致命错误:在第 5 行的 C:\wamp\www\sep24\et\s\wr.php 中找不到类 'Aws\ElasticTranscoder\ElasticTranscoderClient'

那么应该怎么做..?需要帮助.. 是的,我已经包含了我从 GIT 下载的 AWS 文件夹。

4

2 回答 2

0

如果你通过 Composer 获取包,那么你会发现

  • (a) 您在供应商文件夹中的包裹 ( vendor\aws\aws-sdk-php\src\ElasticTranscoder) 和
  • (b) 供应商文件夹顶层的自动加载文件,名为autoload.php.

您需要加载此文件。这将为它安装的所有类启用 Composer Autoloader。

<?php
require 'vendor/autoload.php';

或使用您的代码:

<?php
require 'vendor/autoload.php';

use Aws\ElasticTranscoder\ElasticTranscoderClient;

$elasticTranscoder = ElasticTranscoderClient::factory($options);

可能是文件夹错了。让我们定义根文件夹并在此基础上要求自动加载器:

define('ROOT', dirname(__FILE__));
require ROOT . '/vendor/autoload.php';

它是一个简单的包含路径问题。

于 2015-09-24T14:10:10.153 回答
0

Try below code

<?php
require_once("path_to_ElasticTranscoderClient_file");
use Aws\ElasticTranscoder\ElasticTranscoderClient; 
$elasticTranscoder = ElasticTranscoderClient::factory(array(
.....
.....
?>

or user composer to autoload this file.

于 2015-09-24T07:05:25.093 回答