hxy2015/yii2-oss
Composer 安装命令:
composer require hxy2015/yii2-oss
包简介
Oss integration for the Yii framework
README 文档
README
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist hxy2015/yii2-oss
or add
"hxy2015/yii2-oss": "~1.0"
to the require section of your composer.json.
Configuration
To use this extension, you have to configure the Connection class in your application configuration:
return [ //.... 'components' => [ 'oss' => [ 'hostname' => 'localhost', 'bucket' => 'risk-test', 'accessId' => 'test', // oss id 'accessKey' => 'test', // oss id ], ] ];
Usage
Upload File
$oss = \Yii::$app->get('oss'); $oss->putObjectByContent('some_dir/some_file_name', 'hehe'); $filename = 'test.txt'; file_put_contents($filename, 'hehe'); $oss->putObjectByFile('some_dir/some_file_name', $filename);
Download File
$oss = \Yii::$app->get('oss'); $oss->getObjectContent('some_dir/some_file_name'); $filename = 'test.txt'; $oss->getObjectFile('some_dir/some_file_name', $filename);
Test File Exist
$oss = \Yii::$app->get('oss'); $oss->isObjectExist('some_dir/some_file_name');
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2017-09-04