<?php
namespace OSS;
use OSS\Core\MimeTypes;
use OSS\Core\OssException;
use OSS\Http\RequestCore;
use OSS\Http\RequestCore_Exception;
use OSS\Http\ResponseCore;
use OSS\Model\CorsConfig;
use OSS\Model\CnameConfig;
use OSS\Model\LoggingConfig;
use OSS\Model\LiveChannelConfig;
use OSS\Model\LiveChannelInfo;
use OSS\Model\LiveChannelListInfo;
use OSS\Model\StorageCapacityConfig;
use OSS\Result\AclResult;
use OSS\Result\BodyResult;
use OSS\Result\GetCorsResult;
use OSS\Result\GetLifecycleResult;
use OSS\Result\GetLoggingResult;
use OSS\Result\GetRefererResult;
use OSS\Result\GetWebsiteResult;
use OSS\Result\GetCnameResult;
use OSS\Result\GetLocationResult;
use OSS\Result\HeaderResult;
use OSS\Result\InitiateMultipartUploadResult;
use OSS\Result\ListBucketsResult;
use OSS\Result\ListMultipartUploadResult;
use OSS\Model\ListMultipartUploadInfo;
use OSS\Result\ListObjectsResult;
use OSS\Result\ListPartsResult;
use OSS\Result\PutSetDeleteResult;
use OSS\Result\DeleteObjectsResult;
use OSS\Result\CopyObjectResult;
use OSS\Result\CallbackResult;
use OSS\Result\ExistResult;
use OSS\Result\PutLiveChannelResult;
use OSS\Result\GetLiveChannelHistoryResult;
use OSS\Result\GetLiveChannelInfoResult;
use OSS\Result\GetLiveChannelStatusResult;
use OSS\Result\ListLiveChannelResult;
use OSS\Result\GetStorageCapacityResult;
use OSS\Result\AppendResult;
use OSS\Model\ObjectListInfo;
use OSS\Result\UploadPartResult;
use OSS\Model\BucketListInfo;
use OSS\Model\LifecycleConfig;
use OSS\Model\RefererConfig;
use OSS\Model\WebsiteConfig;
use OSS\Core\OssUtil;
use OSS\Model\ListPartsInfo;
use OSS\Result\SymlinkResult;
/**
* Class OssClient
*
* Object Storage Service(OSS) 的客户端类,封装了用户通过OSS API对OSS服务的各种操作,
* 用户通过OssClient实例可以进行Bucket,Object,MultipartUpload, ACL等操作,具体
* 的接口规则可以参考官方OSS API文档
*/
class OssClient
{
/**
* 构造函数
*
* 构造函数有几种情况:
* 1. 一般的时候初始化使用 $ossClient = new OssClient($id, $key, $endpoint)
* 2. 如果使用CNAME的,比如使用的是www.testoss.com,在控制台上做了CNAME的绑定,
* 初始化使用 $ossClient = new OssClient($id, $key, $endpoint, true)
* 3. 如果使用了阿里云SecurityTokenService(STS),获得了AccessKeyID, AccessKeySecret, Token
* 初始化使用 $ossClient = new OssClient($id, $key, $endpoint, false, $token)
* 4. 如果用户使用的endpoint是ip
* 初始化使用 $ossClient = new OssClient($id, $key, “1.2.3.4:8900”)
*
* @param string $accessKeyId 从OSS获得的AccessKeyId
* @param string $accessKeySecret 从OSS获得的AccessKeySecret
* @param string $endpoint 您选定的OSS数据中心访问域名,例如oss-cn-hangzhou.aliyuncs.com
* @param boolean $isCName 是否对Bucket做了域名绑定,并且Endpoint参数填写的是自己的域名
* @param string $securityToken
* @param string $requestProxy 添加代理支持
* @throws OssException
*/
public function __construct($accessKeyId, $accessKeySecret, $endpoint, $isCName = false, $securityToken = NULL, $requestProxy = NULL)
{
$accessKeyId = trim($accessKeyId);
$accessKeySecret = trim($accessKeySecret);
$endpoint = trim(trim($endpoint), "/");
if (empty($accessKeyId)) {
throw new OssException("access key id is empty");
}
if (empty($accessKeySecret)) {
throw new OssException("access key secret is empty");
}
if (empty($endpoint)) {
throw new OssException("endpoint is empty");
}
$this->hostname = $this->checkEndpoint($endpoint, $isCName);
$this->accessKeyId = $accessKeyId;
$this->accessKeySecret = $accessKeySecret;
$this->securityToken = $securityToken;
$this->requestProxy = $requestProxy;
self::checkEnv();
}
/**
* 列举用户所有的Bucket[GetService], Endpoint类型为cname不能进行此操作
*
* @param array $options
* @throws OssException
* @return BucketListInfo
*/
public function listBuckets($options = NULL)
{
if ($this->hostType === self::OSS_HOST_TYPE_CNAME) {
throw new OssException("operation is not permitted with CName host");
}
$this->precheckOptions($options);
$options[self::OSS_BUCKET] = '';
$options[self::OSS_METHOD] = self::OSS_HTTP_GET;
$options[self::OSS_OBJECT] = '/';
$response = $this->auth($options);
$result = new ListBucketsResult($response);
return $result->getData();
}
/**
* 创建bucket,默认创建的bucket的ACL是OssClient::OSS_ACL_TYPE_PRIVATE
*
* @param string $bucket
* @param string $acl
* @param array $options
* @param string $storageType
* @return null
*/
public function createBucket($bucket, $acl = self::OSS_ACL_TYPE_PRIVATE, $options = NULL)
{
$this->precheckCommon($bucket, NULL, $options, false);
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
$options[self::OSS_OBJECT] = '/';
$options[self::OSS_HEADERS] = array(self::OSS_ACL => $acl);
if (isset($options[self::OSS_STORAGE])) {
$this->precheckStorage($options[self::OSS_STORAGE]);
$options[self::OSS_CONTENT] = OssUtil::createBucketXmlBody($options[self::OSS_STORAGE]);
unset($options[self::OSS_STORAGE]);
}
$response = $this->auth($options);
$result = new PutSetDeleteResult($response);
return $result->getData();
}
/**
* 删除bucket
* 如果Bucket不为空(Bucket中有Object,或者有分块上传的碎片),则Bucket无法删除,
* 必须删除Bucket中的所有Object以及碎片后,Bucket才能成功删除。
*
* @param string $bucket
* @param array $options
* @return null
*/
public function deleteBucket($bucket, $options = NULL)
{
$this->precheckCommon($bucket, NULL, $options, false);
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_METHOD] = self::OSS_HTTP_DELETE;
$options[self::OSS_OBJECT] = '/';
$response = $this->auth($options);
$result = new PutSetDeleteResult($response);
return $result->getData();
}
/**
* 判断bucket是否存在
*
* @param string $bucket
* @return bool
* @throws OssException
*/
public function doesBucketExist($bucket)
{
$this->precheckCommon($bucket, NULL, $options, false);
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_METHOD] = self::OSS_HTTP_GET;
$options[self::OSS_OBJECT] = '/';
$options[self::OSS_SUB_RESOURCE] = 'acl';
$response = $this->auth($options);
$result = new ExistResult($response);
return $result->getData();
}
/**
* 获取bucket所属的数据中心位置信息
*
* @param string $bucket
* @param array $options
* @throws OssException
* @return string
*/
public function getBucketLocation($bucket, $options = NULL)
{
$this->precheckCommon($bucket, NULL, $options, false);
$options[self::OSS_BUCKET] = $bucket;
$options[self::OSS_METHOD] = self::OSS_HTTP_GET;
$options[self::OSS_OBJECT] = '/';
$options[self::OSS_SUB_RESOURCE] = 'location';
$response = $this->auth($options);
$result = new GetLocationResult($response);
return $result->getData();
}
/**
* 获取Bucket的Meta信息
*
* @param string $bucket
* @param array $options 具体参考SDK文档
* @return array
*/
public function getBucketMeta($bucket, $options = NULL)
{
$this->precheckCommon($bucket, NULL, $options, false);
$opt
没有合适的资源?快使用搜索试试~ 我知道了~
文明城市小程序源码V1.0.5 前后端
共295个文件
php:113个
jpg:38个
png:34个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 1 下载量 35 浏览量
2022-02-16
15:56:57
上传
评论 1
收藏 3.14MB ZIP 举报
温馨提示
文明城市小程序源码V1.0.5 前后端
资源推荐
资源详情
资源评论
收起资源包目录
文明城市小程序源码V1.0.5 前后端 (295个子文件)
style.css 136KB
meet_phone.css 89KB
diy.min.css 76KB
v3.css 58KB
foxui.diy.css 26KB
web.css 13KB
meetingPhone.css 12KB
simple.switch.three.css 11KB
dropload.css 1KB
madmin.css 941B
quest.css 705B
menu.html 22KB
setting.html 17KB
quest.html 15KB
slider.html 8KB
admin.html 7KB
madmin.html 5KB
news.html 4KB
class.html 4KB
comment.html 4KB
head_a.html 3KB
setpkg.html 3KB
menu.html 2KB
reight.html 2KB
tfile.html 2KB
user.html 2KB
foot.html 578B
head.html 162B
toroght.svg_Zone.Identifier 50B
201809_1537000606.jpg 183KB
201809_1537015411.jpg 167KB
201809_1537015439.jpg 167KB
201809_1537015515.jpg 123KB
201809_1537015357.jpg 116KB
201809_1537929680.jpg 96KB
201809_1537013692.jpg 77KB
201809_1537239763.jpg 77KB
201809_1537159653.jpg 77KB
201809_1537027333.jpg 76KB
201809_1537026112.jpg 76KB
201809_1537025317.jpg 76KB
201809_1537025264.jpg 76KB
201809_1537154786.jpg 75KB
201809_1537155441.jpg 75KB
201809_1537155838.jpg 75KB
201809_1537156467.jpg 75KB
201809_1537013700.jpg 69KB
201809_1537926049.jpg 68KB
201809_1537925142.jpg 68KB
201809_1537926095.jpg 68KB
201809_1537922939.jpg 68KB
201809_1537923933.jpg 68KB
201809_1537925514.jpg 68KB
201809_1537022943.jpg 67KB
201810_1538551404.jpg 59KB
201809_1537064702.jpg 54KB
201809_1536916778.jpg 53KB
201809_1537023319.jpg 53KB
201809_1536916768.jpg 53KB
201809_1537923249.jpg 44KB
201809_1537925692.jpg 44KB
201809_1537028357.jpg 43KB
201809_1537162204.jpg 42KB
preview.jpg 34KB
icon.jpg 34KB
201809_1537162004.jpg 30KB
201809_1536993855.jpg 28KB
jquery-2.1.4.js 242KB
showdown.js 37KB
underscore.js 25KB
util.js 16KB
jquery.qrcode.min.js 14KB
htmlToWxml.js 8KB
jquery-migrate-1.2.1.min.js 7KB
bgtdetail.js 6KB
html2json.js 5KB
wxDiscode.js 5KB
md5.js 5KB
report.js 5KB
dropload.min.js 4KB
wxParse.js 3KB
htmlparser.js 3KB
simple.switch.js 3KB
bgt.js 3KB
postbird-img-glass.js 3KB
app.js 2KB
base64.js 2KB
index.js 2KB
mycase.js 1KB
getuser.js 1KB
cfun.js 1KB
webview.js 1KB
profile.js 972B
newsdetail.js 869B
newspage.js 791B
util.js 366B
znl.js 272B
siteinfo.js 201B
app.json 2KB
composer.json 670B
共 295 条
- 1
- 2
- 3
资源评论
- 壹壹壹壹壹壹DWL2023-04-29资源有一定的参考价值,与资源描述一致,很实用,能够借鉴的部分挺多的,值得下载。
智慧浩海
- 粉丝: 1w+
- 资源: 5222
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功