支付宝赞助帐号:service@kuitao8.com 

php 七牛上传远程图片的方法

Created2019-01-17   Views 1138    Author 懒人程序
<?php
header("Content-type:text/html;charset=utf-8");
require_once('./jj_qiniu_new/autoload.php' );
use Qiniu\Auth;
use Qiniu\Storage\UploadManager;
use Qiniu\Storage\BucketManager;
$accessKey = 'accessKey';
$secretKey = 'secretKey';
$bucket = 'kuitao8';
$auth = new Auth($accessKey, $secretKey);
$bucketManager = new BucketManager($auth);
$url = 'http://devtools.qiniu.com/qiniu.png';
$key = "99"."/".time() . '.png';
// 指定抓取的文件保存名称
list($ret, $err) = $bucketManager->fetch($url, $bucket, $key);
echo "=====> fetch $url to bucket: $bucket  key: $key\n";
if ($err !== null) {
    var_dump($err);
} else {
    print_r($ret);
}
上一篇: 手机调试网页工具vconsole
下一篇: php 将word生成pdf
支持键盘 ← →

邮件订阅

订阅我们的精彩内容