Home >Backend Development >PHP Tutorial >七牛云存储 - PHP-sdk获取不到列表文件,请问怎么解决?

七牛云存储 - PHP-sdk获取不到列表文件,请问怎么解决?

WBOY
WBOYOriginal
2016-06-06 20:43:171410browse

代码如下

<code>require_once('php-sdk-master/qiniu/rs.php');

$bucket = "**";
$accessKey = '**';
$secretKey = '**';

Qiniu_SetKeys($accessKey, $secretKey);

function fileList() 
{
    global $bucket;

    require_once('php-sdk-master/qiniu/rsf.php');

    $client = new Qiniu_MacHttpClient(null);
    list($items, $marker,  $err) = Qiniu_RSF_ListPrefix($client, $bucket);

    if ($err !== null) 
    {
        var_dump($err);
    } 
    else 
    {
        var_dump($items);
    }
}

fileList();
</code>

返回一个错误

string 'EOF' (length=3)

请问是什么地方出错了
PS:ASB帐号都对的,这个能确保无误

回复内容:

代码如下

<code>require_once('php-sdk-master/qiniu/rs.php');

$bucket = "**";
$accessKey = '**';
$secretKey = '**';

Qiniu_SetKeys($accessKey, $secretKey);

function fileList() 
{
    global $bucket;

    require_once('php-sdk-master/qiniu/rsf.php');

    $client = new Qiniu_MacHttpClient(null);
    list($items, $marker,  $err) = Qiniu_RSF_ListPrefix($client, $bucket);

    if ($err !== null) 
    {
        var_dump($err);
    } 
    else 
    {
        var_dump($items);
    }
}

fileList();
</code>

返回一个错误

string 'EOF' (length=3)

请问是什么地方出错了
PS:ASB帐号都对的,这个能确保无误

这个应该不是错误,只是打印出来的信息,表示list已经结束了,具体可以查看 https://github.com/qiniu/php-sdk/blob/master/qiniu/rsf.php 文件最上面的注释。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn