bytegs/storage

此包最新版本(dev-master)无可用许可信息。

dev-master 2015-07-28 10:54 UTC

This package is not auto-updated.

Last update: 2024-10-02 18:04:59 UTC


README

  • PHP 5.5

安装

Composer

"require": {
    "bytegs/storage": "dev-master"
}

使用

上传文件:(带有公开链接)

$storage = new \Byte\Storage\Storage("API-KEY");
$res = $storage->upload(__DIR__."/img.png", 1);

结果

array(3) {
  ["id"]=>
  string(1) "3"
  ["md5"]=>
  string(32) "cc5b39ccc9685362f2cdc3ad02716bdb"
  ["link"]=>
  string(66) "http://storage.byte.gs/file/3?md5=cc5b39ccc9685362f2cdc3ad02716bdb"
}

上传文件

$storage = new \Byte\Storage\Storage("API-KEY");
$res = $storage->upload(__DIR__."/img.png");

结果

array(3) {
  ["id"]=>
  string(1) "4"
  ["md5"]=>
  string(32) "cc5b39ccc9685362f2cdc3ad02716bdb"
}

获取文件

$storage = new \Byte\Storage\Storage("API-KEY");
$res = $storage->get(4);

$res 包含文件的源。

删除文件

$storage = new \Byte\Storage\Storage("API-KEY");
$res = $storage->delete(4);