yii2-aliyun-oss
The preferred way to install this extension is through composer.
Either run
composer require --prefer-dist aprsoft/yii2-aliyun-oss "*"
or add
"aprsoft/yii2-aliyun-oss": "*"
to the require section of your composer.json
file.
web.php
'aliyunOssImage' => [
"class" => 'AprSoft\Aliyun\OSS\Image',
"accessKeyId" => 'xxxxxxxxxxxxxx',
"accessKeySecret" => 'xxxxxxxx',
"bucket" => 'xxxxx',
"endpoint" => 'http://oss-cn-zhangjiakou.aliyuncs.com',
],
'aliyunOssBucket' => [
"class" => 'AprSoft\Aliyun\OSS\Bucket',
"accessKeyId" => 'xxxxxxx',
"accessKeySecret" => 'xxxxxx',
"endpoint" => 'http://oss-cn-zhangjiakou.aliyuncs.com',
],
代码中使用
$bucket = Yii::$app->aliyunOssImage;
$back = $bucket->list();