mma*_*ato 1 amazon-s3 aws-php-sdk
我正在使用Amazon AWS SDK for PHP(即2.7.16版)将文件上传到S3存储桶.如何为http/tcp操作(连接,上传等)设置超时?虽然我已经google了很多,但我无法弄清楚如何.
我正在使用的示例代码:
$awsS3Client = Aws\S3\S3Client::factory(array(
'key' => '...',
'secret' => '...'
));
$awsS3Client->putObject(array(
'Bucket' => '...',
'Key' => 'destin/ation.file',
'ACL' => 'private',
'Body' => 'content'
));
Run Code Online (Sandbox Code Playgroud)
所以我想在putObject()通话时设置超时.
谢谢!
最终我帮了自己:
$awsS3Client = Aws\S3\S3Client::factory(array(
'key' => '...',
'secret' => '...'
'curl.options' => array(
CURLOPT_CONNECTTIMEOUT => 5,
CURLOPT_TIMEOUT => 10,
)
));
Run Code Online (Sandbox Code Playgroud)
看起来AWS PHP在内部使用curl,因此以这种方式设置网络相关选项.
| 归档时间: |
|
| 查看次数: |
1258 次 |
| 最近记录: |