【发布时间】:2016-06-09 21:47:35
【问题描述】:
我有以下代码应该删除目录和其中的所有内容。
它似乎工作正常,但由于某种原因,当代码运行时,我在我的应用引擎日志中收到以下警告。
有谁知道为什么会发生这种情况,或者是否有更好的方法来避免这些错误?
PHP 警告:云存储错误:第 223 行 /base/data/home/runtimes/php/sdk/google/appengine/ext/cloud_storage_streams/CloudStorageDirectoryClient.php 中未找到
function deleteDir($dirPath)
{
if (! is_dir($dirPath)) {
die("not a directory");
}
if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
$dirPath .= '/';
}
$files = glob($dirPath . '*', GLOB_MARK);
foreach ($files as $file) {
if (is_dir($file)) {
deleteDir($file);
} else {
unlink($file);
}
}
rmdir($dirPath);
}
deleteDir("gs://folder/folder");
【问题讨论】:
标签: php google-app-engine google-cloud-storage