OSS\OssClient::createObjectDir PHP Method

createObjectDir() public method

暂不开放此接口
public createObjectDir ( string $bucket, string $object, array $options = NULL ) : null
$bucket string bucket名称
$object string object名称
$options array
return null
    public function createObjectDir($bucket, $object, $options = NULL)
    {
        $this->precheckCommon($bucket, $object, $options);
        $options[self::OSS_BUCKET] = $bucket;
        $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
        $options[self::OSS_OBJECT] = $object . '/';
        $options[self::OSS_CONTENT_LENGTH] = array(self::OSS_CONTENT_LENGTH => 0);
        $response = $this->auth($options);
        $result = new PutSetDeleteResult($response);
        return $result->getData();
    }

Usage Example

 /**
  * Create a directory.
  *
  * @param string $dirname directory name
  * @param Config $config
  * @return array|false
  */
 public function createDir($dirname, Config $config)
 {
     $object = $this->applyPathPrefix($dirname);
     $options = $this->getOptionsFromConfig($config);
     try {
         $this->client->createObjectDir($this->bucket, $object, $options);
     } catch (OssException $e) {
         return false;
     }
     return ['path' => $dirname, 'type' => 'dir'];
 }
All Usage Examples Of OSS\OssClient::createObjectDir