//获取上传token
Vendor('sdk.autoload');
$accessKey='********'; $secretKey='*******'; $auth=new \Qiniu\Auth($accessKey,$secretKey); $token=$auth->uploadToken('***'); //此路径为绝对路径 $filePath =$path; // 上传到七牛后保存的文件名 $key = 'ceshi.txt'; $uploadMgr = new \Qiniu\Storage\UploadManager(); list($ret, $err) = $uploadMgr->putFile($token, $key, $filePath); if ($err !== null) { $res['content']=$err; $res['error'] = 201; } else { //进行入库 $res['content']='成功'; $res['error']= 200; }
转载于:https://www.cnblogs.com/phpwyl/p/8780921.html