我使用这个非官方的 api 来管理 dropbox 上的文件,我想在我的网站上显示文件列表,并通过这个列表使用 metod delete() 管理它们。
要返回文件列表,我使用:
include('../dropbox-2-k/vendor/autoload.php');
use Kunnu\Dropbox\DropboxApp;
use Kunnu\Dropbox\Dropbox;
$app = new DropboxApp("xxxxxxxxx", "xxxxxx","xxxxxxxxxxxxxxxxx");
//Configure Dropbox service
$dropbox = new Dropbox($app);
$listFolderContents = $dropbox->listFolder("/");
//Fetch Items (Returns an instance of ModelCollection)
$items = $listFolderContents->getItems();
//All Items
$files=$items->toArray();
这将返回一个由 FileMetadata 对象形成的数组,如下所示:
Kunnu\Dropbox\Models\FileMetadata Object ( [id:protected] => id:3QPTxoe-gHAAAAAAAAAAAg [name:protected] => cambio_nome.txt [rev:protected] => 14c8c2758 [size:protected] => 40 [path_lower:protected] => /cambio_nome.txt [media_info:protected] => [sharing_info:protected] => [path_display:protected] => /cambio_nome.txt [client_modified:protected] => 2016-08-13T17:09:42Z [server_modified:protected] => 2016-08-13T17:09:42Z [has_explicit_shared_members:protected] => [data:protected] => Array ( [.tag] => file [name] => cambio_nome.txt [path_lower] => /cambio_nome.txt [path_display] => /cambio_nome.txt [id] => id:3QPTxoe-gHAAAAAAAAAAAg [client_modified] => 2016-08-13T17:09:42Z [server_modified] => 2016-08-13T17:09:42Z [rev] => 14c8c2758 [size] => 40 ) ) Kunnu\Dropbox\Models\FileMetadata Object ( [id:protected] => id:3QPTxoe-gHAAAAAAAAAAAw [name:protected] => 20150805_181544.jpg [rev:protected] => 24c8c2758 [size:protected] => 1735369 [path_lower:protected] => /20150805_181544.jpg [media_info:protected] => [sharing_info:protected] => [path_display:protected] => /20150805_181544.jpg [client_modified:protected] => 2016-08-21T07:34:23Z [server_modified:protected] => 2016-08-21T07:34:23Z [has_explicit_shared_members:protected] => [data:protected] => Array ( [.tag] => file [name] => 20150805_181544.jpg [path_lower] => /20150805_181544.jpg [path_display] => /20150805_181544.jpg [id] => id:3QPTxoe-gHAAAAAAAAAAAw [client_modified] => 2016-08-21T07:34:23Z [server_modified] => 2016-08-21T07:34:23Z [rev] => 24c8c2758 [size] => 1735369 ) )
我必须提取名称([名称:受保护])。
我怎么能这样做?