Dropbox api createshareableling 不工作
Dropbox api createshareableling not working
我创建了一些代码,它上传了一个示例文件,然后应该返回可共享的 url,但它给出了一个错误:
Fatal error: Call to undefined function createShareableLink() in /home/u983866586/public_html/db/dropbox.php on line 52
我的代码:
# Include the Dropbox SDK libraries
require_once "Dropbox/autoload.php";
use \Dropbox as dbx;
$appInfo = dbx\AppInfo::loadFromJsonFile("keys.json");
$webAuth = new dbx\WebAuthNoRedirect($appInfo, "PHP-Example/1.0");
$authorizeUrl = $webAuth->start();
$authCode = "something";
$accessToken= "M4OYlxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$dbxClient = new dbx\Client($accessToken, "PHP-Example/1.0");
$accountInfo = $dbxClient->getAccountInfo();
//~ print_r($accountInfo);
$f = fopen("working-draft.txt", "rb");
$result = $dbxClient->uploadFile("/working-draft.txt", dbx\WriteMode::add(), $f);
fclose($f);
//~ print_r($result);
$folderMetadata = $dbxClient->getMetadataWithChildren("/");
print_r($folderMetadata);
$f = fopen("working-draft.txt", "w+b");
$fileMetadata = $dbxClient->getFile("/working-draft.txt", $f);
fclose($f);
createShareableLink("/working-draft.txt");
函数 createSareableLink 来自:http://dropbox.github.io/dropbox-sdk-php/api-docs/v1.1.x/source-class-Dropbox.Client.html#1007-1038
但它不起作用。
阿伦德-简
我想你只是忘了在 "createShareableLink" 之前使用“$dbxClient->”。
所以这应该适合你:
$linkToShare = $dbxClient->createShareableLink("/working-draft.txt");
echo $linkToShare;
我创建了一些代码,它上传了一个示例文件,然后应该返回可共享的 url,但它给出了一个错误:
Fatal error: Call to undefined function createShareableLink() in /home/u983866586/public_html/db/dropbox.php on line 52
我的代码:
# Include the Dropbox SDK libraries
require_once "Dropbox/autoload.php";
use \Dropbox as dbx;
$appInfo = dbx\AppInfo::loadFromJsonFile("keys.json");
$webAuth = new dbx\WebAuthNoRedirect($appInfo, "PHP-Example/1.0");
$authorizeUrl = $webAuth->start();
$authCode = "something";
$accessToken= "M4OYlxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$dbxClient = new dbx\Client($accessToken, "PHP-Example/1.0");
$accountInfo = $dbxClient->getAccountInfo();
//~ print_r($accountInfo);
$f = fopen("working-draft.txt", "rb");
$result = $dbxClient->uploadFile("/working-draft.txt", dbx\WriteMode::add(), $f);
fclose($f);
//~ print_r($result);
$folderMetadata = $dbxClient->getMetadataWithChildren("/");
print_r($folderMetadata);
$f = fopen("working-draft.txt", "w+b");
$fileMetadata = $dbxClient->getFile("/working-draft.txt", $f);
fclose($f);
createShareableLink("/working-draft.txt");
函数 createSareableLink 来自:http://dropbox.github.io/dropbox-sdk-php/api-docs/v1.1.x/source-class-Dropbox.Client.html#1007-1038 但它不起作用。
阿伦德-简
我想你只是忘了在 "createShareableLink" 之前使用“$dbxClient->”。
所以这应该适合你:
$linkToShare = $dbxClient->createShareableLink("/working-draft.txt");
echo $linkToShare;