1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?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->CreateFileMetaIndex(array(
- 'AppId' => 'AppId',
- 'Headers' => array(
- 'Accept' => 'application/json',
- 'Content-Type' => 'application/json',
- ),
- 'DatasetName'=> 'test001',
-
- 'File'=> array(
- 'CustomId'=> '001',
- 'CustomLabels'=> array('age' => '18','level' => '18',)
- ,
- 'MediaType'=> 'image',
- 'ContentType'=> 'image/jpeg',
- 'URI'=> 'cos://examplebucket-1250000000/test.jpg',
- 'MaxFaceNum'=> 20,
- ),
- ));
-
- print_r($result);
- } catch (\Exception $e) {
-
- echo($e);
- }
|