美文网首页
七牛简单上传

七牛简单上传

作者: 小进我是爸爸 | 来源:发表于2020-08-18 22:41 被阅读0次
<?php
header("Content-type:text/html;charset=utf-8");
require_once('../vendor/autoload.php' );
use Qiniu\Auth;
use Qiniu\Storage\UploadManager;
use Qiniu\Storage\BucketManager;
$accessKey = 'XXXX';
$secretKey = 'XXXX';
$bucket = 'XXX';//仓库
$auth = new Auth($accessKey, $secretKey);//验证
$bucketManager = new BucketManager($auth);
$url = 'http://ww1.sinaimg.cn/large/85ccde71gw1fasksq840yj20dc0a6jrp.jpg';
$extension = pathinfo($url)['extension'];//后缀
$key = time() . '.'.$extension;
$ret = $bucketManager->fetch($url, $bucket, $key);
// 返回值,
var_dump($ret);


相关文章

网友评论

      本文标题:七牛简单上传

      本文链接:https://www.haomeiwen.com/subject/qtsljktx.html