首页 > 代码库 > 七牛 在线管理 v0.1

七牛 在线管理 v0.1

<?php// @codingStandardsIgnoreFilerequire_once __DIR__.‘/../vendor/autoload.php‘;use Qiniu\Auth;  use Qiniu\Storage\BucketManager;$accessKey = ‘PkDMktpjk29Ag0n86_1mtF7zhX9f1RJCyHcgjnCI‘;$secretKey = ‘8gI2seqsKitvRn59CeOSgna_VyI82E2244JHmqj9‘;$testAuth = new Auth($accessKey, $secretKey);$bucketMgr = new BucketManager($testAuth);$bucket = ‘iosios‘;$key = ‘aaa.pdf‘;$prefix = $_GET[‘p‘];$marker = ‘‘;$limit = 300;$dirs = array();$files = array();list($iterms, $marker, $err) = $bucketMgr->listFiles($bucket, $prefix, $marker, $limit);if ($err !== null) {} else {    foreach ($iterms as $obj) {        $sub = substr($obj["key"], strlen($prefix));        //文件夹标记(可创建文件夹的)        if($sub=="") { continue ;}                //还有文件夹的        if (strpos( $sub,"$")){            $arr = explode("$", $sub);            $dirs[$arr[0]]="";        //没有文件夹了        }else{        $files[$sub]="";        }    }}?><!DOCTYPE html><html><head>    <title>七牛数据管理</title></head><body><?php    if($prefix!=""){ ?><a href="http://www.mamicode.com/#">返回上一页..</a><br><a href="http://www.mamicode.com/#">返回首页</a><br><br><br><?php } ?></body></html>

 

七牛 在线管理 v0.1