1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- require dirname(__FILE__) . '/../vendor/autoload.php';
- $secretId = "COS_SECRETID";
- $secretKey = "COS_SECRETKEY";
- $region = "ap-beijing";
- $cosClient = new Qcloud\Cos\Client(
- array(
- 'region' => $region,
- 'schema' => 'https',
- 'credentials'=> array(
- 'secretId' => $secretId ,
- 'secretKey' => $secretKey)));
- try {
- $result = $cosClient->putBucketCors(array(
- 'Bucket' => 'examplebucket-125000000',
- 'CORSRules' => array(
- array(
- 'AllowedHeaders' => array('*',),
- 'AllowedMethods' => array('Put', ),
- 'AllowedOrigins' => array('*', ),
- 'ExposeHeaders' => array('*', ),
- 'MaxAgeSeconds' => 1,
- ),
-
- )
- ));
-
- print_r($result);
- } catch (\Exception $e) {
-
- echo "$e\n";
- }
|