- @author crazyfd crazyfd@qq.com
- @version 1.0
file upload for Yii Framework 2
php > 5.5
Get it via composer by adding the package to your composer.json
:
{
"require": {
"crazyfd/yii2-qiniu": "dev-master"
}
}
php composer.phar update
<?php
use crazyfd\qiniu\Qiniu;
$qiniu = new Qiniu($ak, $sk,$domain, $bucket);
$key = time();
$qiniu->uploadFile($_FILES['tmp_name'],$key);
$url = $qiniu->getLink($key);