API | 操作名 | 操作描述 |
设置对象标签 | 为对象设置标签 | |
查询对象标签 | 查询指定对象下已有的对象标签 | |
删除对象标签 | 删除指定对象下已有的对象标签 |
public Guzzle\\Service\\Resource\\Model PutObjectTagging(array $args = array());
<?phprequire dirname(__FILE__) . '/../vendor/autoload.php';$secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.tencentcloud.com/cam/capi$secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.tencentcloud.com/cam/capi$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的region可以在控制台查看,https://console.tencentcloud.com/cos5/bucket$cosClient = new Qcloud\\Cos\\Client(array('region' => $region,'schema' => 'https', //协议头部,默认为http'credentials'=> array('secretId' => $secretId ,'secretKey' => $secretKey)));try {$result = $cosClient->putObjectTagging(array('Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.tencentcloud.com/cos5/bucket'Key' => 'exampleobject','TagSet' => array(array('Key'=>'key1','Value'=>'value1',),array('Key'=>'key2','Value'=>'value2',),),));// 请求成功print_r($result);} catch (\\Exception $e) {// 请求失败echo "$e\\n";}
参数名称 | 描述 | 类型 |
Key | 标签的 key | String |
Value | 标签的 value | String |
public Guzzle\\Service\\Resource\\Model GetObjectTagging(array $args = array());
<?phprequire dirname(__FILE__) . '/../vendor/autoload.php';$secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.tencentcloud.com/cam/capi$secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.tencentcloud.com/cam/capi$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的region可以在控制台查看,https://console.tencentcloud.com/cos5/bucket$cosClient = new Qcloud\\Cos\\Client(array('region' => $region,'schema' => 'https', //协议头部,默认为http'credentials'=> array('secretId' => $secretId ,'secretKey' => $secretKey)));try {$result = $cosClient->getObjectTagging(array('Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.tencentcloud.com/cos5/bucket'Key' => 'exampleobject',));// 请求成功print_r($result);} catch (\\Exception $e) {// 请求失败echo($e);}
GuzzleHttp\\Command\\Result Object([TagSet] => Array([0] => Array([Key] => key1[Value] => value1)[1] => Array([Key] => key2[Value] => value2))[RequestId] => NWRmMWVkMjFfMjJiMjU4NjRfNWQ3X2EwMWVj****)
成员变量 | 描述 | 类型 |
Key | 标签的键 | String |
Value | 标签的值 | String |
public Guzzle\\Service\\Resource\\Model DeleteObjectTagging(array $args = array());
<?phprequire dirname(__FILE__) . '/../vendor/autoload.php';$secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.tencentcloud.com/cam/capi$secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.tencentcloud.com/cam/capi$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的region可以在控制台查看,https://console.tencentcloud.com/cos5/bucket$cosClient = new Qcloud\\Cos\\Client(array('region' => $region,'schema' => 'https', //协议头部,默认为http'credentials'=> array('secretId' => $secretId ,'secretKey' => $secretKey)));try {$result = $cosClient->deleteObjectTagging(array('Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.tencentcloud.com/cos5/bucket'Key' => 'exampleobject',);// 请求成功print_r($result);} catch (\\Exception $e) {// 请求失败echo($e);}
本页内容是否解决了您的问题?