当前位置:网站首页>微信小程序 上传七牛云 laravel
微信小程序 上传七牛云 laravel
2022-06-22 03:42:00 【.海上月】
使用Lin_ui添加样式
<l-image-picker name="image"/>.js 获取图片 图片传到后台为一个数组,先转换成字符格式
var image=e.detail.value.image.join(',');利用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;
}
边栏推荐
- Mysql 45讲学习笔记(三)SQL更新语句的执行
- 告警日志中出现ORA-48132 ORA-48170
- A component required a bean of type 'com. example. demo3.service. UserServiceImp' that could not be fou
- 力扣:用两个栈实现一个队列
- Flutter 颜色渐变及模仿淘宝渐变关注按钮
- Flutter-Stream使用
- How to implement dart asynchrony
- 关于在dialog中调用edittext这个件事
- Application method and operation of Beifu cx9020 (wince 7) controller
- 128陷阱——源码分析
猜你喜欢

【BP回归预测】基于matlab GA优化BP回归预测(含优化前的对比)【含Matlab源码 1901期】

Use yolov5 to train your own data set; Installation and use of yolov5; Interpretation of yolov5 source code

Direct insertion sort of eight sorts

How to synchronize the oak camera?

PLC program variable definition and hardware IO Association in Bifu twincat3

八大排序之直接插入排序

Invalid character found in request destination. Valid characters are defined in RFC 7230 and RFC 3986

How to install laravel

Beifu TwinCAT sets the scanning cycle and operation cycle method of PLC

Contact and understanding in PowerDesigner CDM
随机推荐
平衡二叉树——调整变换规则
C51的一些日记
Implementation of common function blocks for Beifu twincat3 servo control
倍福TwinCAT3 Ads错误查询列表
Comment dart asynchrone est implémenté
128陷阱——源码分析
LOCAL=NO
3DE save to Favorites
Blazor University (31) form - Validation
How to randomly assign 1000 to 10 numbers
未來已來:雲原生時代
倍福TwinCAT 3 气缸动作程序编写
【BP回归预测】基于matlab GA优化BP回归预测(含优化前的对比)【含Matlab源码 1901期】
Blazor University (31)表单 —— 验证
H指数问题
How to realize SVN efficient management
Solend闹剧背后的「DeFi道德悖论」
What are the differences between SVN and CVS
Zombie process and orphan process
我在华为度过的 “两辈子”(学习那些在大厂表现优秀的人)