2017 © Pedro Peláez
 

library cos-sdk-v4

PHP SDK for QCloud COS

image

actom/cos-sdk-v4

PHP SDK for QCloud COS

  • Wednesday, December 20, 2017
  • by ACTom
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 24 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

cos-php-sdk:php sdk for 腾讯云对象存储服务

安装(直接下载源码集成)

直接从github下载源码,然后在您的程序中加载cos-php-sdk-v4/include.php就可以了。, (*1)

修改配置

配置使用数组形式, (*2)

COS所在的区域(region),对应关系如下: 华南 -> gz 华中 -> sh 华北 -> tj, (*3)

$config = array(
    'app_id' => '',
    'secret_id' => '',
    'secret_key' => '',
    'region' => 'gz',
    'timeout' => 60
);

示例程序

请参考sample.php, (*4)

// 包含cos-php-sdk-v4/include.php文件
require('cos-php-sdk-v4/include.php');
use QCloud\Cos\Api;

$config = array(
    'app_id' => '',
    'secret_id' => '',
    'secret_key' => '',
    'region' => 'gz',
    'timeout' => 60
);
$cosApi = new Api($config);

// 创建文件夹
$ret = $cosApi->createFolder($bucket, $folder);
var_dump($ret);

// 上传文件
$ret = $cosApi->upload($bucket, $src, $dst);
var_dump($ret);

// 下载文件
$ret = $cosApi->download($bucket, $src, $dst);
var_dump($ret);

// 目录列表
$ret = $cosApi->listFolder($bucket, $folder);
var_dump($ret);

// 更新目录信息
$bizAttr = "";
$ret = $cosApi->updateFolder($bucket, $folder, $bizAttr);
var_dump($ret);

// 更新文件信息
$bizAttr = '';
$authority = 'eWPrivateRPublic';
$customerHeaders = array(
    'Cache-Control' => 'no',
    'Content-Type' => 'application/pdf',
    'Content-Language' => 'ch',
);
$ret = $cosApi->update($bucket, $dst, $bizAttr, $authority, $customerHeaders);
var_dump($ret);

// 查询目录信息
$ret = $cosApi->statFolder($bucket, $folder);
var_dump($ret);

// 查询文件信息
$ret = $cosApi->stat($bucket, $dst);
var_dump($ret);

// 删除文件
$ret = $cosApi->delFile($bucket, $dst);
var_dump($ret);

// 删除目录
$ret = $cosApi->delFolder($bucket, $folder);
var_dump($ret);

// 复制文件
$ret = $cosApi->copyFile($bucket, '/111.txt', '/111_2.txt');
var_dump($ret);

// 移动文件
$ret = $cosApi->moveFile($bucket, '/111.txt', '/111_3.txt');
var_dump($ret);

The Versions

20/12 2017

dev-master

9999999-dev

PHP SDK for QCloud COS

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar yaozongyou
by Avatar ACTom

php cos qcloud

04/09 2017

v4.3.7

4.3.7.0

PHP SDK for QCloud COS

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar yaozongyou
by Avatar ACTom

php cos qcloud

03/09 2017

v4.3.6

4.3.6.0

PHP SDK for QCloud COS

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar yaozongyou
by Avatar ACTom

php cos qcloud

01/09 2017

v4.3.5

4.3.5.0

PHP SDK for QCloud COS

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar yaozongyou
by Avatar ACTom

php cos qcloud

21/08 2017

v4.3.4

4.3.4.0

PHP SDK for QCloud COS

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar yaozongyou
by Avatar ACTom

php cos qcloud

21/07 2017

v4.3.3

4.3.3.0

PHP SDK for QCloud COS

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar yaozongyou
by Avatar ACTom

php cos qcloud

26/06 2017

v4.3.2

4.3.2.0

PHP SDK for QCloud COS

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar yaozongyou
by Avatar ACTom

php cos qcloud