本文整理汇总了PHP中Aws\S3\S3Client::deleteObjects方法的典型用法代码示例。如果您正苦于以下问题:PHP S3Client::deleteObjects方法的具体用法?PHP S3Client::deleteObjects怎么用?PHP S3Client::deleteObjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aws\S3\S3Client
的用法示例。
在下文中一共展示了S3Client::deleteObjects方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteObjects
/**
* This operation enables you to delete multiple objects from a bucket using a single HTTP request.
* You may specify up to 1000 keys.
*
* @param string $bucket
* @param array $objects
*
* @return mixed
*/
public function deleteObjects($bucket, array $objects)
{
$params = ['Bucket' => $bucket, 'Objects' => []];
foreach ($objects as $object) {
$objects[] = ['Key' => $object];
}
return $this->instance->deleteObjects($params);
}
示例2: bulkDelete
/**
* @param array $files
*/
public function bulkDelete(array $files)
{
$objects = [];
foreach ($files as $filePath) {
$objects[] = ['Key' => Utils::normalizePath($this->relativePath . '/' . $filePath)];
}
$this->s3Client->deleteObjects(['Bucket' => $this->basePath, 'Delete' => ['Objects' => $objects]]);
}
示例3: delete
/**
* @param $files
* @return mixed
*/
public function delete($files)
{
$result['status'] = false;
$objects = [];
foreach ($files as $fileKey) {
$objects[] = $fileKey;
}
try {
$deleteResult = $this->s3->deleteObjects(['Bucket' => $this->bucket, 'Delete' => ['Objects' => $objects]]);
$result['status'] = true;
$result['data'] = $deleteResult;
} catch (S3Exception $e) {
echo $e . "\nThere was an error uploading the file.\n";
}
return $result;
}
示例4: rmdir
public function rmdir($path)
{
$path = $this->normalizePath($path);
if (!$this->file_exists($path)) {
return false;
}
// Since there are no real directories on S3, we need
// to delete all objects prefixed with the path.
$objects = $this->connection->listObjects(array('Bucket' => $this->bucket, 'Prefix' => $path . '/'));
try {
$result = $this->connection->deleteObjects(array('Bucket' => $this->bucket, 'Objects' => $objects['Contents']));
$this->testTimeout();
} catch (S3Exception $e) {
\OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
return false;
}
return true;
}
示例5: remove
/**
* Remove an attached file.
*
* @param array $filePaths
*/
public function remove(array $filePaths)
{
if ($filePaths) {
$this->s3Client->deleteObjects(['Bucket' => $this->attachedFile->s3_object_config['Bucket'], 'Delete' => ['Objects' => $this->getKeys($filePaths)]]);
}
}