相关疑难解决方法(0)

如何修复'我们计算的请求签名与签名'错误不匹配?

我已经在网上搜索了两天以上,可能已经浏览了大多数在线记录的场景和解决方法,但到目前为止我没有任何作用.

我在运行PHP 5.3的AWS SDK for PHP V2.8.7上.我正在尝试使用以下代码连接到我的S3存储桶:

// Create a `Aws` object using a configuration file

        $aws = Aws::factory('config.php');

        // Get the client from the service locator by namespace
        $s3Client = $aws->get('s3');

        $bucket = "xxx";
        $keyname = "xxx";

        try {
            $result = $s3Client->putObject(array(
                'Bucket'        =>      $bucket,
                'Key'           =>      $keyname,
                'Body'          =>      'Hello World!'
            ));
            $file_error = false;
        } catch (Exception $e) {
            $file_error = true;
            echo $e->getMessage();
            die();
        }
        //  
Run Code Online (Sandbox Code Playgroud)

我的config.php文件如下:

<?php

return array(
    // Bootstrap the configuration file with …
Run Code Online (Sandbox Code Playgroud)

amazon-s3 amazon-web-services aws-php-sdk

53
推荐指数
18
解决办法
8万
查看次数