Google 會運用 AI 技術將內容翻譯成你偏好的語言,但可能會出錯。
提供意見
透過 C++ 適用的 Cloud Storage 刪除檔案
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
將檔案上傳至 Cloud Storage 後,也可以刪除檔案。
注意: 根據預設,Cloud Storage for Firebase bucket 需要 Firebase Authentication 才能對 bucket 的資料或檔案執行任何動作。您可以變更 Cloud Storage 的 Firebase Security Rules ,允許在特定情況下進行未經驗證的存取 。不過,在大多數情況下,我們強烈建議限制存取權並設定完善的安全性規則 (尤其是正式版應用程式)。請注意,如果您使用 Google App Engine ,且預設 Cloud Storage bucket 的名稱格式為 *.appspot.com ,則可能需要考量安全性規則對 App Engine 檔案存取權的影響 。 刪除檔案
如要刪除檔案,請先建立該檔案的參考檔案 ,然後對該參照呼叫 Delete() 方法。
// Create a reference to the file to delete.
StorageReference * desert_ref = storage_ref . Child ( "images/desert.jpg" );
// Delete the file
Future future = desert_ref . Delete ();
// Wait for operation to complete...
if ( future . Error () != firebase :: storage :: kErrorNone ) {
// Uh-oh, an error occurred!
} else {
// File deleted successfully
}
注意: 虛刪除 功能預設為啟用,因此刪除的檔案通常可在 7 天內復原。
處理錯誤
刪除檔案時發生錯誤的原因有很多,包括檔案不存在,或使用者沒有刪除指定檔案的權限。如要進一步瞭解錯誤,請參閱文件的「處理錯誤 」一節。
提供意見
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權 ,程式碼範例則為阿帕契 2.0 授權 。詳情請參閱《Google Developers 網站政策 》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2026-10-16 (世界標準時間)。
想進一步說明嗎?
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2026-10-16 (世界標準時間)。"],[],[]]