PHP code example of crazyfd / yii2-qiniu

1. Go to this page and download the library: Download crazyfd/yii2-qiniu library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

crazyfd / yii2-qiniu example snippets


composer install


$ak = 'sss';
$sk = 'sss';
$domain = 'http://demo.domain.com/';
$bucket = 'demo';
$zone = 'south_china';
use crazyfd\qiniu\Qiniu;
$qiniu = new Qiniu($ak, $sk,$domain, $bucket,$zone);
$key = time();
$key .= strtolower(strrchr($_FILES['name'], '.'));

$qiniu->uploadFile($_FILES['tmp_name'],$key);
$url = $qiniu->getLink($key);