Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon s3 如何为Amazon AWS SDK for PHP设置http超时_Amazon S3_Aws Php Sdk - Fatal编程技术网

Amazon s3 如何为Amazon AWS SDK for PHP设置http超时

Amazon s3 如何为Amazon AWS SDK for PHP设置http超时,amazon-s3,aws-php-sdk,Amazon S3,Aws Php Sdk,我正在使用AmazonAWSSDKforPHP(即2.7.16版)将文件上载到S3存储桶。如何设置http/tcp操作(连接、上载等)的超时?虽然我在谷歌上搜索了很多次,但还是没能找到答案 我正在使用的示例代码: $awsS3Client = Aws\S3\S3Client::factory(array( 'key' => '...', 'secret' => '...' )); $awsS3Client->putObject(arra

我正在使用AmazonAWSSDKforPHP(即2.7.16版)将文件上载到S3存储桶。如何设置http/tcp操作(连接、上载等)的超时?虽然我在谷歌上搜索了很多次,但还是没能找到答案

我正在使用的示例代码:

$awsS3Client = Aws\S3\S3Client::factory(array(
        'key' => '...',
        'secret' => '...'
    ));

$awsS3Client->putObject(array(
            'Bucket' => '...',
            'Key'    => 'destin/ation.file',
            'ACL'    => 'private',
            'Body'   => 'content'
        ));
因此,我想在
putObject()
调用上设置一个超时


谢谢

最后,我帮助自己:

$awsS3Client = Aws\S3\S3Client::factory(array(
        'key' => '...',
        'secret' => '...'
        'curl.options' => array(
            CURLOPT_CONNECTTIMEOUT => 5,
            CURLOPT_TIMEOUT => 10,
        )
    ));
看起来AWS PHP在内部使用curl,所以网络相关选项是这样设置的