diff --git a/sample/getObjectUrl.php b/sample/getObjectUrl.php index 18d02bb7..656ffbde 100644 --- a/sample/getObjectUrl.php +++ b/sample/getObjectUrl.php @@ -9,22 +9,29 @@ array( 'region' => $region, 'schema' => 'https', //协议头部,默认为http - 'credentials'=> array( - 'secretId' => $secretId , - 'secretKey' => $secretKey))); + 'credentials' => array( + 'secretId' => $secretId, + 'secretKey' => $secretKey + ) + ) +); $local_path = "/data/exampleobject"; -try { +try { $bucket = "examplebucket-1250000000"; //存储桶,格式:BucketName-APPID $key = "exampleobject"; //对象在存储桶中的位置,即对象键 - $signedUrl = $cosClient->getObjectUrl($bucket, - $key, - '+10 minutes' //签名的有效时间 - ['ResponseContentDisposition' => '111', - 'Params' => [ // Params中可以传自定义querystring - 'aaa' => 'bbb', - 'ccc' => 'ddd' - ]]); + $signedUrl = $cosClient->getObjectUrl( + $bucket, + $key, + '+10 minutes', //签名的有效时间 + [ + 'ResponseContentDisposition' => '111', + 'Params' => [ // Params中可以传自定义querystring + 'aaa' => 'bbb', + 'ccc' => 'ddd' + ] + ] + ); // 请求成功 echo $signedUrl; } catch (\Exception $e) {