1

我正在尝试学习保管箱 php-api。我已完成上传,但无法在 Dropbox 帐户中创建新文件夹(如果不存在)

代码片段:

// Create new directory
$create_new_folder = $dropbox->createFolder('new_folder','dropbox');

// Create a temporary file and write some data to it
$tmp = tempnam('/tmp', 'dropbox');
$data = 'This file was uploaded using the Dropbox API!';
file_put_contents($tmp, $data);

// Upload the file with an alternative filename
$put = $dropbox->putFile($tmp, 'abc.txt');

// Unlink the temporary file
unlink($tmp);

// Dump the output
var_dump($put);

错误:

在第 18 行调用 C:\wamp\www\BenTheDesigner-Dropbox-b49576c\examples\putFile.php 中未定义的方法 Dropbox\API::createFolder()

4

2 回答 2

2

就用它

require_once('bootstrap.php');

// 创建新目录 $create_new_folder = $dropbox->create('docs','dropbox');

现在检查您的保管箱:)

于 2012-05-17T06:04:25.377 回答
1

此错误似乎表明您正在尝试调用不存在的名为“createFolder”的函数。检查图书馆:

https://github.com/BenTheDesigner/Dropbox/blob/master/Dropbox/API.php

看起来该函数实际上只是命名为“create”:

/**
 * Creates a folder
 * @param string New folder to create relative to root
 * @return object stdClass
 */
public function create($path)
{
于 2012-04-20T19:48:34.183 回答