<?php
require dirname(__FILE__) . '/../vendor/autoload.php';
$secretId = "SECRETID";
$secretKey = "SECRETKEY";
$region = "ap-beijing";
$cosClient = new Qcloud\\Cos\\Client(
array(
'region' => $region,
'schema' => 'https',
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
$bucket = 'examplebucket-125000000';
$key = 'exampleobject';
try {
$customerKey = 'abcdefghijklmnopqrstuvwxyz123456';
$SSECustomerKey = base64_encode($customerKey);
$SSECustomerKeyMd5 = base64_encode(md5($customerKey, true));
$result = $cosClient->putObject(array(
'Bucket' => $bucket,
'Key' => $key,
'Body' => 'string',
'SSECustomerAlgorithm' => 'AES256',
'SSECustomerKey' => $SSECustomerKey,
'SSECustomerKeyMD5' => $SSECustomerKeyMd5,
));
print_r ($result);
} catch (Qcloud\\Cos\\Exception\\ServiceResponseException $e) {
echo $e;
}
本页内容是否解决了您的问题?