添加网站文件

This commit is contained in:
2025-12-22 13:59:40 +08:00
commit 117aaf83d1
19468 changed files with 2111999 additions and 0 deletions

View 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);
}

View 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(); // 获取完整的响应
}

View 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);
}

View 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);
}

View 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);
}

View 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);
}

View 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);
}

View 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);
}

View 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);
}

View 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";
}

View 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);
}

View 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);
}

View 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";
}

View 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);
}

View 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);
}

View 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);
}

View 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";
}

View 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);
}

View 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);
}

View 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);
}

View 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);
}

View 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";
}

View 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);
}

View 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);
}

View 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);
}

View 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);
}

View 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);
}

View 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);
}

View 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);
}

View 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);
}

View 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);
}

View 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";
}

View 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";
}

View 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";
}

View 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";
}

View 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";
}

View 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";
}

View 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";
}

View 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";
}

View 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);
}

View 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);
}

View 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);
}

View 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);
}

View 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);
}