添加网站文件
This commit is contained in:
27
vendor/qcloud/cos-sdk-v5/sample/abortMultipartUpload.php
vendored
Normal file
27
vendor/qcloud/cos-sdk-v5/sample/abortMultipartUpload.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->abortMultipartUpload(array(
|
||||
'Bucket' => 'examplebucket-125000000', //格式:BucketName-APPID
|
||||
'Key' => 'exampleobject',
|
||||
'UploadId' => 'string',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
30
vendor/qcloud/cos-sdk-v5/sample/catchException.php
vendored
Normal file
30
vendor/qcloud/cos-sdk-v5/sample/catchException.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->getBucketAcl(array(
|
||||
'Bucket' => 'examplebucket-125000000' //格式:BucketName-APPID
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
$statusCode = $e->getStatusCode(); // 获取错误码
|
||||
$errorMessage = $e->getMessage(); // 获取错误信息
|
||||
$requestId = $e->getRequestId(); // 获取错误的requestId
|
||||
$errorCode = $e->getCosErrorCode(); // 获取错误名称
|
||||
$request = $e->getRequest(); // 获取完整的请求
|
||||
$response = $e->getResponse(); // 获取完整的响应
|
||||
}
|
||||
|
||||
37
vendor/qcloud/cos-sdk-v5/sample/completeMultipartUpload.php
vendored
Normal file
37
vendor/qcloud/cos-sdk-v5/sample/completeMultipartUpload.php
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->completeMultipartUpload(array(
|
||||
'Bucket' => 'examplebucket-125000000', //格式:BucketName-APPID
|
||||
'Key' => 'exampleobject',
|
||||
'UploadId' => 'string',
|
||||
'Parts' => array(
|
||||
array(
|
||||
'ETag' => 'string',
|
||||
'PartNumber' => integer,
|
||||
),
|
||||
array(
|
||||
'ETag' => 'string',
|
||||
'PartNumber' => integer,
|
||||
)),
|
||||
// ... repeated
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
32
vendor/qcloud/cos-sdk-v5/sample/copy.php
vendored
Normal file
32
vendor/qcloud/cos-sdk-v5/sample/copy.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
$local_path = "/data/exampleobject";
|
||||
try {
|
||||
$result = $cosClient->copy(
|
||||
$bucket = 'examplebucket-125000000', //格式:BucketName-APPID
|
||||
$key = 'exampleobject',
|
||||
$copySorce = array(
|
||||
'Region' => '<sourceRegion>',
|
||||
'Bucket' => '<sourceBucket>',
|
||||
'Key' => '<sourceKey>',
|
||||
)
|
||||
);
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
28
vendor/qcloud/cos-sdk-v5/sample/copyObject.php
vendored
Normal file
28
vendor/qcloud/cos-sdk-v5/sample/copyObject.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->copyObject(array(
|
||||
'Bucket' => 'examplebucket-125000000', //格式:BucketName-APPID
|
||||
'Key' => 'exampleobject',
|
||||
'CopySource' => 'examplebucket2-125000000.cos.ap-guangzhou.myqcloud.com/exampleobject',
|
||||
'MetadataDirective' => 'Replaced',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
25
vendor/qcloud/cos-sdk-v5/sample/createBucket.php
vendored
Normal file
25
vendor/qcloud/cos-sdk-v5/sample/createBucket.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->createBucket(array(
|
||||
'Bucket' => 'examplebucket-125000000' //格式:BucketName-APPID
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
39
vendor/qcloud/cos-sdk-v5/sample/createMultipartUpload.php
vendored
Normal file
39
vendor/qcloud/cos-sdk-v5/sample/createMultipartUpload.php
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->createMultipartUpload(array(
|
||||
'Bucket' => 'examplebucket-125000000', //格式:BucketName-APPID
|
||||
'Key' => 'exampleobject',
|
||||
/*
|
||||
'CacheControl' => 'string',
|
||||
'ContentDisposition' => 'string',
|
||||
'ContentEncoding' => 'string',
|
||||
'ContentLanguage' => 'string',
|
||||
'ContentLength' => integer,
|
||||
'ContentType' => 'string',
|
||||
'Expires' => 'string',
|
||||
'Metadata' => array(
|
||||
'string' => 'string',
|
||||
),
|
||||
'StorageClass' => 'string'
|
||||
*/
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
25
vendor/qcloud/cos-sdk-v5/sample/deleteBucket.php
vendored
Normal file
25
vendor/qcloud/cos-sdk-v5/sample/deleteBucket.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->deleteBucket(array(
|
||||
'Bucket' => 'examplebucket-125000000' //格式:BucketName-APPID
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
25
vendor/qcloud/cos-sdk-v5/sample/deleteBucketCors.php
vendored
Normal file
25
vendor/qcloud/cos-sdk-v5/sample/deleteBucketCors.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->deleteBucketCors(array(
|
||||
'Bucket' => 'examplebucket-125000000' //格式:BucketName-APPID
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
24
vendor/qcloud/cos-sdk-v5/sample/deleteBucketDomain.php
vendored
Normal file
24
vendor/qcloud/cos-sdk-v5/sample/deleteBucketDomain.php
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->deleteBucketDomain(array(
|
||||
'Bucket' => 'examplebucket-125000000', //格式:BucketName-APPID
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo "$e\n";
|
||||
}
|
||||
25
vendor/qcloud/cos-sdk-v5/sample/deleteBucketLifecycle.php
vendored
Normal file
25
vendor/qcloud/cos-sdk-v5/sample/deleteBucketLifecycle.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->deleteBucketLifecycle(array(
|
||||
'Bucket' => 'examplebucket-125000000' //格式:BucketName-APPID
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
25
vendor/qcloud/cos-sdk-v5/sample/deleteBucketTagging.php
vendored
Normal file
25
vendor/qcloud/cos-sdk-v5/sample/deleteBucketTagging.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->deleteBucketTagging(array(
|
||||
'Bucket' => 'examplebucket-125000000' //格式:BucketName-APPID
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
24
vendor/qcloud/cos-sdk-v5/sample/deleteBucketWebsite.php
vendored
Normal file
24
vendor/qcloud/cos-sdk-v5/sample/deleteBucketWebsite.php
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->deleteBucketWebsite(array(
|
||||
'Bucket' => 'examplebucket-125000000', //格式:BucketName-APPID
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo "$e\n";
|
||||
}
|
||||
26
vendor/qcloud/cos-sdk-v5/sample/deleteObject.php
vendored
Normal file
26
vendor/qcloud/cos-sdk-v5/sample/deleteObject.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->deleteObject(array(
|
||||
'Bucket' => 'examplebucket-125000000', //格式:BucketName-APPID
|
||||
'Key' => 'exampleobject',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
25
vendor/qcloud/cos-sdk-v5/sample/getBucketAcl.php
vendored
Normal file
25
vendor/qcloud/cos-sdk-v5/sample/getBucketAcl.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->getBucketAcl(array(
|
||||
'Bucket' => 'examplebucket-125000000' //格式:BucketName-APPID
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
25
vendor/qcloud/cos-sdk-v5/sample/getBucketCors.php
vendored
Normal file
25
vendor/qcloud/cos-sdk-v5/sample/getBucketCors.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->getBucketCors(array(
|
||||
'Bucket' => 'examplebucket-125000000' //格式:BucketName-APPID
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
24
vendor/qcloud/cos-sdk-v5/sample/getBucketDomain.php
vendored
Normal file
24
vendor/qcloud/cos-sdk-v5/sample/getBucketDomain.php
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->getBucketDomain(array(
|
||||
'Bucket' => 'examplebucket-125000000', //格式:BucketName-APPID
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo "$e\n";
|
||||
}
|
||||
26
vendor/qcloud/cos-sdk-v5/sample/getBucketInventory.php
vendored
Normal file
26
vendor/qcloud/cos-sdk-v5/sample/getBucketInventory.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->getBucketInvnetory(array(
|
||||
'Bucket' => 'examplebucket-125000000', //格式:BucketName-APPID
|
||||
'Id' => 'string',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
25
vendor/qcloud/cos-sdk-v5/sample/getBucketLifecycle.php
vendored
Normal file
25
vendor/qcloud/cos-sdk-v5/sample/getBucketLifecycle.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->getBucketLifecycle(array(
|
||||
'Bucket' => 'examplebucket-125000000' //格式:BucketName-APPID
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
25
vendor/qcloud/cos-sdk-v5/sample/getBucketLogging.php
vendored
Normal file
25
vendor/qcloud/cos-sdk-v5/sample/getBucketLogging.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->getBucketLogging(array(
|
||||
'Bucket' => 'examplebucket-125000000' //格式:BucketName-APPID
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
25
vendor/qcloud/cos-sdk-v5/sample/getBucketTagging.php
vendored
Normal file
25
vendor/qcloud/cos-sdk-v5/sample/getBucketTagging.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->getBucketTagging(array(
|
||||
'Bucket' => 'examplebucket-125000000' //格式:BucketName-APPID
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
24
vendor/qcloud/cos-sdk-v5/sample/getBucketWebsite.php
vendored
Normal file
24
vendor/qcloud/cos-sdk-v5/sample/getBucketWebsite.php
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->getBucketWebsite(array(
|
||||
'Bucket' => 'examplebucket-125000000', //格式:BucketName-APPID
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo "$e\n";
|
||||
}
|
||||
36
vendor/qcloud/cos-sdk-v5/sample/getObject.php
vendored
Normal file
36
vendor/qcloud/cos-sdk-v5/sample/getObject.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->getObject(array(
|
||||
'Bucket' => 'examplebucket-125000000', //格式:BucketName-APPID
|
||||
'Key' => 'exampleobject',
|
||||
'SaveAs' => '/data/exampleobject',
|
||||
/*
|
||||
'Range' => 'bytes=0-10',
|
||||
'ResponseCacheControl' => 'string',
|
||||
'ResponseContentDisposition' => 'string',
|
||||
'ResponseContentEncoding' => 'string',
|
||||
'ResponseContentLanguage' => 'string',
|
||||
'ResponseContentType' => 'string',
|
||||
'ResponseExpires' => 'string',
|
||||
*/
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
27
vendor/qcloud/cos-sdk-v5/sample/getObjectUrl.php
vendored
Normal file
27
vendor/qcloud/cos-sdk-v5/sample/getObjectUrl.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
$local_path = "/data/exampleobject";
|
||||
|
||||
try {
|
||||
$bucket = "examplebucket-1250000000"; //存储桶,格式:BucketName-APPID
|
||||
$key = "exampleobject"; //对象在存储桶中的位置,即对象键
|
||||
$signedUrl = $cosClient->getObjectUrl($bucket, $key, '+10 minutes'); //签名的有效时间
|
||||
// 请求成功
|
||||
echo $signedUrl;
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
print_r($e);
|
||||
}
|
||||
|
||||
29
vendor/qcloud/cos-sdk-v5/sample/getPresignetUrl.php
vendored
Normal file
29
vendor/qcloud/cos-sdk-v5/sample/getPresignetUrl.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
$local_path = "/data/exampleobject";
|
||||
try {
|
||||
$signedUrl = $cosClient->getPresignetUrl(
|
||||
$method='putObject',
|
||||
$args=['Bucket'=>'examplebucket-1250000000', //格式:BucketName-APPID
|
||||
'Key'=>'exampleobject',
|
||||
'Body'=>''],
|
||||
$expires='+30 minutes"');
|
||||
// 请求成功
|
||||
echo($signedUrl);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
25
vendor/qcloud/cos-sdk-v5/sample/headBucket.php
vendored
Normal file
25
vendor/qcloud/cos-sdk-v5/sample/headBucket.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->headBucket(array(
|
||||
'Bucket' => 'examplebucket-125000000' //格式:BucketName-APPID
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
26
vendor/qcloud/cos-sdk-v5/sample/headObject.php
vendored
Normal file
26
vendor/qcloud/cos-sdk-v5/sample/headObject.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->headObject(array(
|
||||
'Bucket' => 'examplebucket-125000000', //格式:BucketName-APPID
|
||||
'Key' => 'exampleobject',
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
24
vendor/qcloud/cos-sdk-v5/sample/listBucket.php
vendored
Normal file
24
vendor/qcloud/cos-sdk-v5/sample/listBucket.php
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
|
||||
try {
|
||||
$result = $cosClient->listBuckets();
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
31
vendor/qcloud/cos-sdk-v5/sample/listMultipartUploads.php
vendored
Normal file
31
vendor/qcloud/cos-sdk-v5/sample/listMultipartUploads.php
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->listMultipartUploads(array(
|
||||
'Bucket' => 'examplebucket-125000000', //格式:BucketName-APPID
|
||||
'Delimiter' => '/',
|
||||
'EncodingType' => 'url',
|
||||
'KeyMarker' => 'string',
|
||||
'UploadIdMarker' => 'string',
|
||||
'Prefix' => 'prfix',
|
||||
'MaxUploads' => 1000,
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
30
vendor/qcloud/cos-sdk-v5/sample/listObjects.php
vendored
Normal file
30
vendor/qcloud/cos-sdk-v5/sample/listObjects.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->listObjects(array(
|
||||
'Bucket' => 'examplebucket-125000000', //格式:BucketName-APPID
|
||||
'Delimiter' => '/',
|
||||
'EncodingType' => 'url',
|
||||
'Marker' => 'prefix/picture.jpg',
|
||||
'Prefix' => 'prfix',
|
||||
'MaxKeys' => 1000,
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
29
vendor/qcloud/cos-sdk-v5/sample/listParts.php
vendored
Normal file
29
vendor/qcloud/cos-sdk-v5/sample/listParts.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->listParts(array(
|
||||
'Bucket' => 'examplebucket-125000000', //格式:BucketName-APPID
|
||||
'Key' => 'exampleobject',
|
||||
'UploadId' => 'NWNhNDY0YzFfMmZiNTM1MGFfNTM2YV8xYjliMTg',
|
||||
'PartNumberMarker' => 1,
|
||||
'MaxParts' => 1000,
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
41
vendor/qcloud/cos-sdk-v5/sample/putBucketAcl.php
vendored
Normal file
41
vendor/qcloud/cos-sdk-v5/sample/putBucketAcl.php
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->putBucketAcl(array(
|
||||
//bucket的命名规则为{name}-{appid} ,此处填写的存储桶名称必须为此格式
|
||||
'Bucket' => 'examplebucket-125000000',
|
||||
'ACL' => 'private',
|
||||
'Grants' => array(
|
||||
array(
|
||||
'Grantee' => array(
|
||||
'DisplayName' => 'qcs::cam::uin/100000000001:uin/100000000001',
|
||||
'ID' => 'qcs::cam::uin/100000000001:uin/100000000001',
|
||||
'Type' => 'CanonicalUser',
|
||||
),
|
||||
'Permission' => 'FULL_CONTROL',
|
||||
),
|
||||
// ... repeated
|
||||
),
|
||||
'Owner' => array(
|
||||
'DisplayName' => 'qcs::cam::uin/3210232098:uin/3210232098',
|
||||
'ID' => 'qcs::cam::uin/3210232098:uin/3210232098',
|
||||
)));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo "$e\n";
|
||||
}
|
||||
|
||||
33
vendor/qcloud/cos-sdk-v5/sample/putBucketCors.php
vendored
Normal file
33
vendor/qcloud/cos-sdk-v5/sample/putBucketCors.php
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->putBucketCors(array(
|
||||
'Bucket' => 'examplebucket-125000000', //格式:BucketName-APPID
|
||||
'CORSRules' => array(
|
||||
array(
|
||||
'ID' => '1234',
|
||||
'AllowedHeaders' => array('*'),
|
||||
'AllowedMethods' => array('PUT'),
|
||||
'AllowedOrigins' => array('http://www.qq.com'),
|
||||
),
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo "$e\n";
|
||||
}
|
||||
|
||||
33
vendor/qcloud/cos-sdk-v5/sample/putBucketDomain.php
vendored
Normal file
33
vendor/qcloud/cos-sdk-v5/sample/putBucketDomain.php
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->putBucketDomain(array(
|
||||
'Bucket' => 'examplebucket-125000000', //格式:BucketName-APPID
|
||||
'DomainRules' => array(
|
||||
array(
|
||||
'Name' => 'www.qq.com',
|
||||
'Status' => 'ENABLED',
|
||||
'Type' => 'REST',
|
||||
'ForcedReplacement' => 'CNAME',
|
||||
),
|
||||
// ... repeated
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo "$e\n";
|
||||
}
|
||||
46
vendor/qcloud/cos-sdk-v5/sample/putBucketInventory.php
vendored
Normal file
46
vendor/qcloud/cos-sdk-v5/sample/putBucketInventory.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->putBucketInventory(array(
|
||||
'Bucket' => 'examplebucket-125000000', //格式:BucketName-APPID
|
||||
'Id' => 'string',
|
||||
'Destination' => array(
|
||||
'COSBucketDestination'=>array(
|
||||
'Format' => 'CSV',
|
||||
'AccountId' => '125000000',
|
||||
'Bucket' => 'qcs::cos:ap-chengdu::examplebucket-125000000',
|
||||
'Prefix' => 'string',
|
||||
)
|
||||
),
|
||||
'IsEnabled' => 'True',
|
||||
'Schedule' => array(
|
||||
'Frequency' => 'Daily',
|
||||
),
|
||||
'Filter' => array(
|
||||
'Prefix' => 'string',
|
||||
),
|
||||
'IncludedObjectVersions' => 'Current',
|
||||
'OptionalFields' => array(
|
||||
'Size',
|
||||
'ETag',
|
||||
)
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo "$e\n";
|
||||
}
|
||||
|
||||
45
vendor/qcloud/cos-sdk-v5/sample/putBucketLifecycle.php
vendored
Normal file
45
vendor/qcloud/cos-sdk-v5/sample/putBucketLifecycle.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->putBucketLifecycle(array(
|
||||
'Bucket' => 'examplebucket-125000000', //格式:BucketName-APPID
|
||||
'Rules' => array(
|
||||
array(
|
||||
'Expiration' => array(
|
||||
'Days' => integer,
|
||||
),
|
||||
'ID' => 'string',
|
||||
'Filter' => array(
|
||||
'Prefix' => 'string'
|
||||
),
|
||||
'Status' => 'string',
|
||||
'Transitions' => array(
|
||||
array(
|
||||
'Days' => integer,
|
||||
'StorageClass' => 'string'
|
||||
),
|
||||
// ... repeated
|
||||
),
|
||||
),
|
||||
// ... repeated
|
||||
)
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo "$e\n";
|
||||
}
|
||||
|
||||
29
vendor/qcloud/cos-sdk-v5/sample/putBucketLogging.php
vendored
Normal file
29
vendor/qcloud/cos-sdk-v5/sample/putBucketLogging.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->putBucketLogging(array(
|
||||
'Bucket' => 'examplebucket-125000000', //格式:BucketName-APPID
|
||||
'LoggingEnabled' => array(
|
||||
'TargetBucket' => 'examplebucket2-125000000', //格式:BucketName-APPID
|
||||
'TargetPrefix' => '',
|
||||
)
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo "$e\n";
|
||||
}
|
||||
|
||||
33
vendor/qcloud/cos-sdk-v5/sample/putBucketTagging.php
vendored
Normal file
33
vendor/qcloud/cos-sdk-v5/sample/putBucketTagging.php
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->putBucketTagging(array(
|
||||
'Bucket' => 'examplebucket-125000000', //格式:BucketName-APPID
|
||||
'TagSet' => array(
|
||||
array('Key'=>'key1',
|
||||
'Value'=>'value1',
|
||||
),
|
||||
array('Key'=>'key2',
|
||||
'Value'=>'value2',
|
||||
),
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo "$e\n";
|
||||
}
|
||||
|
||||
46
vendor/qcloud/cos-sdk-v5/sample/putBucketWebsite.php
vendored
Normal file
46
vendor/qcloud/cos-sdk-v5/sample/putBucketWebsite.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
|
||||
try {
|
||||
$result = $cosClient->putBucketWebsite(array(
|
||||
'Bucket' => 'examplebucket-125000000', //格式:BucketName-APPID
|
||||
'IndexDocument' => array(
|
||||
'Suffix' => 'index.html',
|
||||
),
|
||||
'RedirectAllRequestsTo' => array(
|
||||
'Protocol' => 'https',
|
||||
),
|
||||
'ErrorDocument' => array(
|
||||
'Key' => 'Error.html',
|
||||
),
|
||||
'RoutingRules' => array(
|
||||
array(
|
||||
'Condition' => array(
|
||||
'HttpErrorCodeReturnedEquals' => '405',
|
||||
),
|
||||
'Redirect' => array(
|
||||
'Protocol' => 'https',
|
||||
'ReplaceKeyWith' => '404.html',
|
||||
),
|
||||
),
|
||||
// ... repeated
|
||||
),
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo "$e\n";
|
||||
}
|
||||
41
vendor/qcloud/cos-sdk-v5/sample/putObject.php
vendored
Normal file
41
vendor/qcloud/cos-sdk-v5/sample/putObject.php
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
$local_path = "/data/exampleobject";
|
||||
try {
|
||||
$result = $cosClient->putObject(array(
|
||||
'Bucket' => 'examplebucket-125000000', //格式:BucketName-APPID
|
||||
'Key' => 'exampleobject',
|
||||
'Body' => fopen($local_path, 'rb'),
|
||||
/*
|
||||
'CacheControl' => 'string',
|
||||
'ContentDisposition' => 'string',
|
||||
'ContentEncoding' => 'string',
|
||||
'ContentLanguage' => 'string',
|
||||
'ContentLength' => integer,
|
||||
'ContentType' => 'string',
|
||||
'Expires' => 'string',
|
||||
'Metadata' => array(
|
||||
'string' => 'string',
|
||||
),
|
||||
'StorageClass' => 'string'
|
||||
*/
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
30
vendor/qcloud/cos-sdk-v5/sample/restoreObject.php
vendored
Normal file
30
vendor/qcloud/cos-sdk-v5/sample/restoreObject.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->putObject(array(
|
||||
'Bucket' => 'examplebucket-125000000', //格式:BucketName-APPID
|
||||
'Key' => 'exampleobject',
|
||||
'Days' => integer,
|
||||
'CASJobParameters' => array(
|
||||
'Tier' =>'string'
|
||||
)
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
54
vendor/qcloud/cos-sdk-v5/sample/selectObjectContent.php
vendored
Normal file
54
vendor/qcloud/cos-sdk-v5/sample/selectObjectContent.php
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey
|
||||
)
|
||||
));
|
||||
try {
|
||||
$result = $cosClient->selectObjectContent(array(
|
||||
'Bucket' => $bucket, //格式:BucketName-APPID
|
||||
'Key' => $key,
|
||||
'Expression' => 'Select * from COSObject s',
|
||||
'ExpressionType' => 'SQL',
|
||||
'InputSerialization' => array(
|
||||
'CompressionType' => 'None',
|
||||
'CSV' => array(
|
||||
'FileHeaderInfo' => 'NONE',
|
||||
'RecordDelimiter' => '\n',
|
||||
'FieldDelimiter' => ',',
|
||||
'QuoteEscapeCharacter' => '"',
|
||||
'Comments' => '#',
|
||||
'AllowQuotedRecordDelimiter' => 'FALSE'
|
||||
)
|
||||
),
|
||||
'OutputSerialization' => array(
|
||||
'CSV' => array(
|
||||
'QuoteField' => 'ASNEEDED',
|
||||
'RecordDelimiter' => '\n',
|
||||
'FieldDelimiter' => ',',
|
||||
'QuoteCharacter' => '"',
|
||||
'QuoteEscapeCharacter' => '"'
|
||||
)
|
||||
),
|
||||
'RequestProgress' => array(
|
||||
'Enabled' => 'FALSE'
|
||||
)
|
||||
));
|
||||
// 请求成功
|
||||
foreach ($result['Data'] as $data) {
|
||||
// 迭代遍历select结果
|
||||
print_r($data);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
49
vendor/qcloud/cos-sdk-v5/sample/upload.php
vendored
Normal file
49
vendor/qcloud/cos-sdk-v5/sample/upload.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
$local_path = "/data/exampleobject";
|
||||
try {
|
||||
$result = $cosClient->upload(
|
||||
$bucket = 'examplebucket-125000000', //格式:BucketName-APPID
|
||||
$key = 'exampleobject',
|
||||
$body = fopen($local_path, 'rb')
|
||||
/*
|
||||
$options = array(
|
||||
'ACL' => 'string',
|
||||
'CacheControl' => 'string',
|
||||
'ContentDisposition' => 'string',
|
||||
'ContentEncoding' => 'string',
|
||||
'ContentLanguage' => 'string',
|
||||
'ContentLength' => integer,
|
||||
'ContentType' => 'string',
|
||||
'Expires' => 'string',
|
||||
'GrantFullControl' => 'string',
|
||||
'GrantRead' => 'string',
|
||||
'GrantWrite' => 'string',
|
||||
'Metadata' => array(
|
||||
'string' => 'string',
|
||||
),
|
||||
'ContentMD5' => 'string',
|
||||
'ServerSideEncryption' => 'string',
|
||||
'StorageClass' => 'string'
|
||||
)
|
||||
*/
|
||||
);
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
31
vendor/qcloud/cos-sdk-v5/sample/uploadPart.php
vendored
Normal file
31
vendor/qcloud/cos-sdk-v5/sample/uploadPart.php
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
require dirname(__FILE__) . '/../vendor/autoload.php';
|
||||
|
||||
$secretId = "COS_SECRETID"; //"云 API 密钥 SecretId";
|
||||
$secretKey = "COS_SECRETKEY"; //"云 API 密钥 SecretKey";
|
||||
$region = "ap-beijing"; //设置一个默认的存储桶地域
|
||||
$cosClient = new Qcloud\Cos\Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials'=> array(
|
||||
'secretId' => $secretId ,
|
||||
'secretKey' => $secretKey)));
|
||||
try {
|
||||
$result = $cosClient->uploadPart(array(
|
||||
'Bucket' => 'examplebucket-125000000', //格式:BucketName-APPID
|
||||
'Key' => 'exampleobject',
|
||||
'Body' => 'string',
|
||||
'UploadId' => 'NWNhNDY0YzFfMmZiNTM1MGFfNTM2YV8xYjliMTg',
|
||||
'PartNumber' => 1,
|
||||
'ContentMD5' => 'string',
|
||||
'ContentLength' => 100,
|
||||
));
|
||||
// 请求成功
|
||||
print_r($result);
|
||||
} catch (\Exception $e) {
|
||||
// 请求失败
|
||||
echo($e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user