我正在尝试学习dropbox 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()
答案 0 :(得分:2)
只需使用它
require_once( 'bootstrap.php中');
//创建新目录 $ create_new_folder = $ dropbox-> create('docs','dropbox');
现在检查您的保管箱:)
答案 1 :(得分: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)
{