1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- require dirname(__FILE__, 2) . '/vendor/autoload.php';
- $secretId = "SECRETID";
- $secretKey = "SECRETKEY";
- $region = "ap-beijing";
- $cosClient = new Qcloud\Cos\Client(
- array(
- 'region' => $region,
- 'scheme' => 'https',
- 'credentials'=> array(
- 'secretId' => $secretId,
- 'secretKey' => $secretKey)));
- try {
-
- $result = $cosClient->createFileCompressJobs(array(
- 'Bucket' => 'examplebucket-125000000',
- 'Tag' => 'FileCompress',
- 'Operation' => array(
- 'UserData' => 'xxx',
- 'FileCompressConfig' => array(
- 'Flatten' => '0',
- 'Format' => 'zip',
- 'Keys' => array(
- 'object1',
- 'object2',
- 'object3',
- ),
- ),
- 'Output' => array(
- 'Region' => $region,
- 'Bucket' => 'examplebucket-125000000',
- 'Object' => 'output/test.zip',
- ),
- ),
- ));
-
- print_r($result);
- } catch (\Exception $e) {
-
- echo($e);
- }
|