dgwht / file
腾讯、阿里对象存储
v1.0.1
2021-01-25 06:30 UTC
Requires
- aliyuncs/oss-sdk-php: ^2.4
- qcloud/cos-sdk-v5: ^2.1
This package is not auto-updated.
Last update: 2025-03-04 23:42:39 UTC
README
安装教程
composer require dgwht/file
使用说明
初始化
use dgwht/File;
//腾讯
//$FILE = new File([
// "appid" => "AKIDzsbAXidT3iT6Ztl2oPVxxxxx",
// "appkey" => "2s582nO1UYXMG6mK7qgcS8xxxxx",
// "region" => "ap-chengdu",
// "bucket" => "test-1252881831",
//],'Tx');
//阿里
$FILE = new File([
"appid" => "LTAI4FdEgtr2kneRWgpSnzQB",
"appkey" => "gSziEzn4t7bJg1jIpFGqeWYRdfwM55",
"region" => "chengdu",
"bucket" => "dgwht-test",
],'Ali');
上传
$ret = $FILE->up("dd/1.php","index.php",[
"Content-Disposition" => "attachment;filename=666.php"//阿里
//"ContentDisposition" => "attachment;filename=666.php"//腾讯
]);
if($ret){
echo "成功:[{$FILE->Msg}]";
}else{
echo "失败:[{$FILE->Msg}]";
}
下载
//获取签名后的下载地址
$url = $FILE->getSignUrl(15,"dd/1.php");
echo "<a href='{$url}'>{$url}</a>";
//header("Location: {$url}"); exit();
删除
$ret = $FILE->del(["dd/1.php","dd/2.php","dd/3.php"]);
if($ret){
echo "成功";
}else{
echo "失败";
}