当前位置:网站首页>Laravel uses Tencent cloud cos5 full tutorial
Laravel uses Tencent cloud cos5 full tutorial
2022-07-07 06:12:00 【Life goes on and battles go on】
laravel Use Tencent cloud COS5 Full course
One download
The first step must be to use composer Install the package , Here is laravel5.8 Version of , So I used cos5
composer require freyo/flysystem-qcloud-cos-v5Two To configure
1、 stay config/app.php Add
'providers' => [
// ...
Freyo\Flysystem\QcloudCOSv5\ServiceProvider::class,
]
2、 To configure config/filesystems.php:
'disks'=>[
// ...
'cosv5' => [
'driver' => 'cosv5',
'region' => env('COSV5_REGION', 'ap-guangzhou'),// In the back is the region set in the console storage bucket
'credentials' => [
'appId' => env('COSV5_APP_ID'),
'secretId' => env('COSV5_SECRET_ID'),
'secretKey' => env('COSV5_SECRET_KEY'),
],
'timeout' => env('COSV5_TIMEOUT', 60),
'connect_timeout' => env('COSV5_CONNECT_TIMEOUT', 60),
'bucket' => env('COSV5_BUCKET'),
'cdn' => env('COSV5_CDN'),
'scheme' => env('COSV5_SCHEME', 'https'),
'read_from_cdn' => env('COSV5_READ_FROM_CDN', false),
],
],
3、 To configure .env: Be careful : hold \\ Take out the back
COSV5_APP_ID=// The console can see appid
COSV5_SECRET_ID=// The console can see SecretId
COSV5_SECRET_KEY=// The console can see SecretKey
COSV5_TIMEOUT=60
COSV5_CONNECT_TIMEOUT=60
COSV5_BUCKET=
COSV5_REGION=ap-guangzhou// The region , If you configure it here, you don't need to config It's equipped with
COSV5_CDN= #https://{your-bucket-name}-{your-app-id}.file.myqcloud.com
COSV5_SCHEME=https
COSV5_READ_FROM_CDN=false
4、 If an error is reported as follows
laravel Driver [] is not supported.
Please be there. cmd Do the following
php artisan config:cache5、 Get secret key URL : Tencent secret key to get the address
3、 ... and Upload files
public function upload_file(Request $request)
{
// Judge the document
$file = $request->file('file');
if(empty($file))
{
return json_encode(['msg'=>' The file cannot be empty ','status'=>0]);
}
// Upload files
$disk = Storage::disk('cosv5');
$file_content = $disk -> put('video_class',$file);// The first parameter is the path where you want to put the file in the bucket , The second parameter is the file object
$file_url = $disk->url($file_content);// Get the online address of the file
return json_encode(['msg'=>' Upload successful ','status'=>1,'data'=>['file_url' => $file_url]]);// Returns the parameter
}


边栏推荐
- Ten stages of becoming a Senior IC Design Engineer. What stage are you in now?
- [SQL practice] a SQL statistics of epidemic distribution across the country
- PTA TIANTI game exercise set l2-003 moon cake test point 2, test point 3 Analysis
- ML之shap:基于adult人口普查收入二分类预测数据集(预测年收入是否超过50k)利用shap决策图结合LightGBM模型实现异常值检测案例之详细攻略
- How much do you know about clothing ERP?
- Red hat install kernel header file
- DC-7靶机
- JVM monitoring and diagnostic tools - command line
- 404 not found service cannot be reached in SAP WebService test
- STM32 key state machine 2 - state simplification and long press function addition
猜你喜欢

软件测试知识储备:关于「登录安全」的基础知识,你了解多少?

SubGHz, LoRaWAN, NB-IoT, 物联网

Vscode for code completion

JVM命令之- jmap:导出内存映像文件&内存使用情况

苹果cms V10模板/MXone Pro自适应影视电影网站模板
![[FPGA tutorial case 13] design and implementation of CIC filter based on vivado core](/img/19/1a6d43c39f2cf810ba754ea9674426.png)
[FPGA tutorial case 13] design and implementation of CIC filter based on vivado core

go-microservice-simple(2) go-Probuffer

如果不知道这4种缓存模式,敢说懂缓存吗?

3531. 哈夫曼树

If you don't know these four caching modes, dare you say you understand caching?
随机推荐
[InstallShield] Introduction
Type de texte de commutation d'entrée et de mot de passe de l'applet natif
ML's shap: Based on the adult census income binary prediction data set (whether the predicted annual income exceeds 50K), use the shap decision diagram combined with the lightgbm model to realize the
@pathvariable 和 @Requestparam的详细区别
Introduction to yarn (one article is enough)
Understand the deserialization principle of fastjson for generics
JVM command - jmap: export memory image file & memory usage
A very good JVM interview question article (74 questions and answers)
PTA 天梯赛练习题集 L2-003 月饼 测试点2,测试点3分析
Introduction to the extension implementation of SAP Spartacus checkout process
Jmeter自带函数不够用?不如自己动手开发一个
Bypass open_ basedir
On the discrimination of "fake death" state of STC single chip microcomputer
STM32 key state machine 2 - state simplification and long press function addition
Dc-7 target
What is make makefile cmake qmake and what is the difference?
原生小程序 之 input切換 text與password類型
How much do you know about clothing ERP?
If you don't know these four caching modes, dare you say you understand caching?
Check point: the core element for enterprises to deploy zero trust network (ztna)