server 52763dedf1 gitignore | 2 gadi atpakaļ | |
---|---|---|
.. | ||
.github | 2 gadi atpakaļ | |
examples | 2 gadi atpakaļ | |
src | 2 gadi atpakaļ | |
tests | 2 gadi atpakaļ | |
.gitignore | 2 gadi atpakaļ | |
.scrutinizer.yml | 2 gadi atpakaļ | |
CHANGELOG.md | 2 gadi atpakaļ | |
CONTRIBUTING.md | 2 gadi atpakaļ | |
LICENSE | 2 gadi atpakaļ | |
README.md | 2 gadi atpakaļ | |
autoload.php | 2 gadi atpakaļ | |
composer.json | 2 gadi atpakaļ | |
phpunit.xml.dist | 2 gadi atpakaļ | |
test-env.sh | 2 gadi atpakaļ |
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文件.