OSS\OssClient::deleteObject PHP Method

deleteObject() public method

删除某个Object
public deleteObject ( string $bucket, string $object, array $options = NULL ) : null
$bucket string bucket名称
$object string object名称
$options array
return null
    public function deleteObject($bucket, $object, $options = NULL)
    {
        $this->precheckCommon($bucket, $object, $options);
        $options[self::OSS_BUCKET] = $bucket;
        $options[self::OSS_METHOD] = self::OSS_HTTP_DELETE;
        $options[self::OSS_OBJECT] = $object;
        $response = $this->auth($options);
        $result = new PutSetDeleteResult($response);
        return $result->getData();
    }

Usage Example

 /**
  * Delete a file.
  *
  * @param string $path
  * @return bool
  */
 public function delete($path)
 {
     $object = $this->applyPathPrefix($path);
     try {
         $this->client->deleteObject($this->bucket, $object);
     } catch (OssException $e) {
         return false;
     }
     return true;
 }
All Usage Examples Of OSS\OssClient::deleteObject