阿里云oss存储中的yourSecurityToken是什么token呀,查了文档没找到
Life注定不平凡
Life注定不平凡 2019-08-17 11:34:24
0
0
1985

// 阿里云主账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM账号进行API访问或日常运维,请登录  创建RAM账号。$accessKeyId = "<yourAccessKeyId>";
$accessKeySecret = "<yourAccessKeySecret>";// Endpoint以杭州为例,其它Region请按实际情况填写。$endpoint = "url";
$bucket= "<yourBucketName>";
$object = "<yourObjectName>";
$securityToken = "<yourSecurityToken>";// 设置URL的有效期为3600秒。$timeout = 3600;try {
   $ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint, false, $securityToken);    // 生成GetObject的签名URL。
   $signedUrl = $ossClient->signUrl($bucket, $object, $timeout);
} catch (OssException $e) {
   printf(__FUNCTION__ . ": FAILED\n");
   printf($e->getMessage() . "\n");    return;
}print(__FUNCTION__ . ": signedUrl: " . $signedUrl . "\n");// 可以使用代码来访问签名的URL,也可以输入到浏览器中进行访问。$request = new RequestCore($signedUrl);// 生成的URL默认以GET方式访问。$request->set_method('GET');
$request->add_header('Content-Type', '');
$request->send_request();
$res = new ResponseCore($request->get_response_header(), $request->get_response_body(), $request->get_response_code());if ($res->isOK()) {    print(__FUNCTION__ . ": OK" . "\n");
} else {    print(__FUNCTION__ . ": FAILED" . "\n");
};

Life注定不平凡
Life注定不平凡

全部回复(0)
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!