server 52763dedf1 gitignore | 2 anni fa | |
---|---|---|
.. | ||
.github | 2 anni fa | |
examples | 2 anni fa | |
src | 2 anni fa | |
tests | 2 anni fa | |
.gitignore | 2 anni fa | |
.scrutinizer.yml | 2 anni fa | |
CHANGELOG.md | 2 anni fa | |
CONTRIBUTING.md | 2 anni fa | |
LICENSE | 2 anni fa | |
README.md | 2 anni fa | |
autoload.php | 2 anni fa | |
composer.json | 2 anni fa | |
phpunit.xml.dist | 2 anni fa | |
test-env.sh | 2 anni fa |
composer
进行安装。可以使用 composer.json 声明依赖,或者运行下面的命令。SDK 包已经放到这里 qiniu/php-sdk
。
bash
$ composer require qiniu/php-sdk
Qiniu SDK版本 | PHP 版本 |
---|---|
7.x | cURL extension, 5.3 - 5.6,7.0 |
6.x | cURL extension, 5.2 - 5.6 |
use Qiniu\Storage\UploadManager;
use Qiniu\Auth;
...
$uploadMgr = new UploadManager();
$auth = new Auth($accessKey, $secretKey);
$token = $auth->uploadToken($bucket);
list($ret, $error) = $uploadMgr->putFile($token, 'key', 'filePath');
...
$ ./vendor/bin/phpunit tests/Qiniu/Tests/
$error
保留了请求响应的信息,失败情况下 ret
为 none
, 将 $error
可以打印出来,提交给我们。详情参考代码提交指南。
The MIT License (MIT).详情见 License文件.