Home > PHP Framework > Laravel > body text

How to configure Laravel to use Qiniu Cloud

藏色散人
Release: 2020-04-05 09:03:19
forward
3481 people have browsed it

Introduction

Just in time, I configured it from scratch and recorded it below.

Recommended: laravel tutorial

Qiniu Cloud Configuration

Qiniu’s documentation is very detailed, so I only include Just go to the official document link

1. Object storage (https://developer.qiniu.com/kodo), create a new storage space

2. Fusion CDN (https:// developer.qiniu.com/fusion), configure the domain name

3. After configuring the domain name in the previous step, you need to go to your domain name provider to bind it. It is also written in the Qiniu Cloud documentation

Install the extension package and configure

Follow the documentation

composer require "overtrue/laravel-filesystem-qiniu"
config/app.php 中在 providers 添加 Overtrue\LaravelFilesystem\Qiniu\QiniuStorageServiceProvider::class,
config/filesystems.php 中在 disks 添加
'qiniu' => [
    'driver'     => 'qiniu',
    'access_key' => env('QINIU_ACCESS_KEY', 'xxxxxxxxxxxxxxxx'),
    'secret_key' => env('QINIU_SECRET_KEY', 'xxxxxxxxxxxxxxxx'),
    'bucket'     => env('QINIU_BUCKET', 'test'),
    'domain'     => env('QINIU_DOMAIN', 'xxx.clouddn.com'), // or host: https://xxxx.clouddn.com
],
Copy after login

Then configure the corresponding values ​​in .env.

The access_key and secret_key are in Qiniu Cloud's personal center, bucket is the name of the storage space, and domain is the custom domain name configured in Fusion CDN

Conclusion

It is very simple to use, just refer to the documentation.

Because I used laravel-admin, and modified config/admin.php as follows

How to configure Laravel to use Qiniu Cloud

The above is the detailed content of How to configure Laravel to use Qiniu Cloud. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template