syships/yii2-qiniu
最新稳定版本:0.0.5
Composer 安装命令:
composer require syships/yii2-qiniu
包简介
The qiniu SDK for the Yii2 framework
关键字:
README 文档
README
This is a personal plugin for study. It is strongly recomended that you not use it. This plugin is unstable.
It is the qiniu plugin for yii2
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist syships/yii2-qiniu "*"
or add
"syships/yii2-qiniu": "*"
to the require section of your composer.json file.
Usage
Before using the extension,you can add the _ide_helper.php under your application folder.
Once the extension is installed, simply use it in your code by :
config:
'components' => [
'qiniu' => [
'class' => 'syships\qiniu\Application',
'accessKey' => "QdgHxWgNAhwiKLbzKtUgdNajI6wZopUEXLGN7Ujf",
'secretKey' => "EKG9b3QW3YsVI0ID-xzDZFbd6I9E-Npey6pnYvI9"
],
],
You can use the code below:
use Qiniu\Storage\UploadManager;
use Yii;
use yii\web\UploadedFile;
$image = UploadedFile::getInstanceByName('image');
$fileName = 'image_' . time() .rand(1000,9999). '.' . $image->getExtension();
$upToken = Yii::$app->qiniu->Auth()->uploadToken("syships-imgs");
$uploadMgr = new UploadManager();
list($result, $error) = $uploadMgr->putFile($upToken, $fileName, $image->tempName);
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2024-07-14