我正在尝试运行这个php脚本
sudo php S3Client.php
然而,我收到这个错误,我找不到的解决方案
PHP Fatal error: Class 'AwsCommonClientAbstractClient' not found in /etc/vendor/aws/aws-sdk-php/src/Aws/S3/S3Client.php on line 121
这是S3client.php 的脚本
namespace AwsS3;
use AwsCommonClientAbstractClient;
use AwsCommonClientClientBuilder;
use AwsCommonClientExpiredCredentialsChecker;
use AwsCommonClientUploadBodyListener;
use AwsCommonEnumClientOptions as Options;
use AwsCommonExceptionRuntimeException;
use AwsCommonExceptionInvalidArgumentException;
use AwsCommonSignatureSignatureV4;
use AwsCommonModelMultipartUploadAbstractTransfer;
use AwsS3ExceptionAccessDeniedException;
use AwsS3ExceptionParserS3ExceptionParser;
use AwsS3ExceptionS3Exception;
use AwsS3ModelClearBucket;
use AwsS3ModelMultipartUploadAbstractTransfer as AbstractMulti;
use AwsS3ModelMultipartUploadUploadBuilder;
use AwsS3SyncDownloadSyncBuilder;
use AwsS3SyncUploadSyncBuilder;
use GuzzleCommonCollection;
use GuzzleHttpEntityBody;
use GuzzleHttpMessageRequestInterface;
use GuzzleIteratorFilterIterator;
use GuzzlePluginBackoffBackoffPlugin;
use GuzzlePluginBackoffCurlBackoffStrategy;
use GuzzlePluginBackoffExponentialBackoffStrategy;
use GuzzlePluginBackoffHttpBackoffStrategy;
use GuzzlePluginBackoffTruncatedBackoffStrategy;
use GuzzleServiceCommandCommandInterface;
use GuzzleServiceCommandFactoryAliasFactory;
use GuzzleServiceCommandFactoryCompositeFactory;
use GuzzleServiceResourceModel;
use GuzzleServiceResourceResourceIteratorInterface;
这是我第一次使用PHP代码和s3,因此我被阻止了感谢的帮助
错误意味着class"Aws\Common\Client\AbstractClient"在您的文件中找不到。
这可能是因为您没有包含正确的文件,或者您引用的文件不存在。
你在类上面添加了自动加载器了吗?
require 'vendor/autoload.php';
请参阅有关aws的文档->https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/getting-started_basic-usage.html