Fatal error: Class 'Aws\ElasticTranscoder\ElasticTranscoderClient' not found in C:\wamp\www\sep24\et\s\wr.php on line 5

家住魔仙堡 提交于 2019-12-24 16:02:02

问题


Tried to run the elastic transoder php code from et/s/wr.php. wr.php contains the php transcoder code. Here is my code.

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

?>

This is the error when I'm running from the loaclhost.

Fatal error: Class 'Aws\ElasticTranscoder\ElasticTranscoderClient' not found in C:\wamp\www\sep24\et\s\wr.php on line 5

So what should be done.. ? Need Help.. and yes i have included the AWS folder which i downloaded from GIT.


回答1:


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.




回答2:


If you fetch the package via Composer, then you will find

  • (a) your package in the vendor folder (vendor\aws\aws-sdk-php\src\ElasticTranscoder) and
  • (b) an autoloading file at the top level of the vendor folder, named autoload.php.

You need to load this file. This enables the Composer Autoloader for all classes installed by it.

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

Or with your code:

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

use Aws\ElasticTranscoder\ElasticTranscoderClient;

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

Maybe the folder is wrong. Let's define the root folder and require the autoloader based on that:

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

Its a simply include path issue.



来源:https://stackoverflow.com/questions/32754647/fatal-error-class-aws-elastictranscoder-elastictranscoderclient-not-found-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!