saviorlv/yii2-aliyun-oss

Yii2 阿里云 OSS

Installs: 16

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 1

Forks: 0

Open Issues: 0

Type:yii2-extension

1.0 2019-01-09 03:43 UTC

This package is auto-updated.

Last update: 2024-12-10 11:54:15 UTC


README

Yii2 阿里云 OSS

安装

composer require saviorlv/yii2-aliyun-oss -vvv

or add

"saviorlv/yii2-aliyun-oss":"^1.0"

使用

在 main.php 文件中做如下修改

components => [
    'oss' => [
        'class' => 'Saviorlv\Aliyun\OSS',
        'accessKeyId' => 'xxxxx', // 阿里云AccessKeyID
        'accessKeySecret' => 'xxxx', // 阿里云 AccessKeySecret
        'bucket' => 'xxx', // bucket
        'endpoint' => 'http://oss-cn-hangzhou.aliyuncs.com', //OSS节点地址
    ],
]

在 controller 中

 \Yii::$app->oss->upload($object,$file);