PHP code example of suframe / think-oss

1. Go to this page and download the library: Download suframe/think-oss 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/ */

    

suframe / think-oss example snippets




return [
    'driver' => \suframe\oss\driver\QiNiu::class,
    'url' => 'oss/upload', //上传的地址,可自定义
    //上传中间件,目前使用的think-admin后台的中间件做身份过滤,可替换成你自己的中间件完成自己的验证
    'middleware' => function() {
        return config('thinkAdmin.routeMiddleware', []);
    },
    //七牛oss配置
    'qiniu' => [
        'accessKey' => '',
        'secretKey' => '',
        'bucketDefault' => 'default', //默认的bucket
        'bucket' => [
            'default' => '' //填写bucket绑定的域名
        ]
    ]
];

$rs = upload_url'] = url(config('oss.url'))->build();
return $rs;

public function image()
{
    return [
        'type' => 'uploadImage',
        'action' => url(config('oss.url'))->build(),
        'callback' => function ($element) {
            $element->data([
                'bucket' => 'suframe',
            ]);
            return $element;
        }
    ];
}