当前位置:网站首页>Laravel8框架七牛云上传
Laravel8框架七牛云上传
2022-06-09 15:54:00 【仙狐酱ღ】
利用composer下载依赖包
composer require itbdw/laravel-storage-qiniu打开 config 文件夹下的 app.php 文件,在 providers 中加入一下代码
itbdw\QiniuStorage\QiniuFilesystemServiceProvider::class,打开 config 文件夹下的 filesystems.php 文件,在 disks中加入一下代码
'qiniu' => [
'driver' => 'qiniu',
'domain' => '', //你的七牛域名
'access_key'=> '', //AccessKey
'secret_key'=> '', //SecretKey
'bucket' => '', //Bucket名字,即七牛云存储空间名称
],在控制器中写入添加的方法
public function fileAdd(){
$disk = \Storage::disk('qiniu'); //使用七牛云上传
$time = date('Y-m-d');
$filename = $disk->put($time, request()->file('image'));//上传
if(!$filename) {
echo "上传失败";
}
$img_url = $disk->getDriver()->downloadUrl($filename); //获取下载链接
echo $img_url;
}边栏推荐
- Start using dapr
- 办公桌子和椅子的选择和注意点
- How to lock the screen with one button when leaving the computer midway
- Latex combat notes 2- document hierarchy and structure
- 应用软件效率测试的执行策略
- LeetCode 327. Number of interval sums
- Reconstruction essentials learning
- 70 DOM reading XML
- May training (day 29) - divide and rule
- virtualBox 虚拟机网卡设置
猜你喜欢
随机推荐
What if win10 cannot find the flight mode switch?
May training (day 27) - figure
R language generalized linear model function GLM, GLM function to build logistic regression model, analyze whether the model is over dispersed, and use hypothesis test to analyze whether the model is
WordPress网站底部的自定页面(如:网站地图等)按钮美化教程
June training (day 02) - string
单体应用和微服务调用区别
字节一面:网站显示不出来,怎么排查?
GoLand运行go程序时working directory的设置问题:报错路径找不到no such file or directory时需检查该配置
Openwrt firewall
Analysis of variable hiding security in contract security
Identityserver4 getting started 1 / 2
五月集训(第23天) —— 字典树
[ctfshow 单身杯]web writeup&&学习一下sed awk基本用法
办公桌子和椅子的选择和注意点
Is it safe to open a new bond? How to open an account
May training (day 28) - Dynamic Planning
R语言plotly可视化:plotly可视化二维直方图等高线图、使用子图的方式在二维直方图等高线图的顶部和右侧添加两个变量的边缘直方图(2D Histogram Contour Subplot)
Moonbeam基金会与Arrington Capital共同启动1亿美金的生态增长基金以促进Moonbeam生态成长
测试必看,初次编写测试用例的要点
Golang reflect: code examples for reflecting (obtaining values) basic data types and struct structures








