目的:java 後臺刪除 七牛雲 數據
代碼:
package com.xdx97.backstage;
import com.qiniu.common.Zone;
import com.qiniu.http.Response;
import com.qiniu.storage.BucketManager;
import com.qiniu.storage.Configuration;
import com.qiniu.util.Auth;
public class Test {
public static void main(String[] args) {
Auth auth = Auth.create("填寫你的AK", "填寫你的SK");
Configuration config = new Configuration(Zone.autoZone());
BucketManager bucketMgr = new BucketManager(auth, config);
//指定需要刪除的文件,和文件所在的存儲空間
String bucketName = "xxx";
String key = "xxx";
try {
Response delete = bucketMgr.delete(bucketName, key);
delete.close();
}catch (Exception e){
e.printStackTrace();
}
System.out.println("結束了");
}
}