//composer require qiniu/php-sdk 下载sdk public function index() { require_once 'vendor/qiniu/php-sdk/autoload.php'; $accessKey = C('ACCESSKEY'); $secretKey = C('SECRETKEY'); // 构建鉴权对象 classLoader('Auth'); $auth = new Auth($accessKey,$secretKey); // 要上传的空间 $bucket = C('BUCKET'); $token = $auth->uploadToken($bucket); $this->assign('token',$token); $this->display(); }
<script src="__PUBLIC__/jquery-2.0.3.min.js"></script>