如何从数组中获取值?

时间:2017-01-04 05:56:47

标签: php arrays

我得到以下输出 - :

echo '<pre>', print_r($client->getMetadata('/Unfiled Documents')), '</pre>';

脚本:

"Unfilled Documents"

如何访问{{1}}内的文件和文件夹。

2 个答案:

答案 0 :(得分:1)

首先你必须得到像这样的文件夹路径: 请尝试以下解决方案可能会起作用

$path  = $client->getMetadata['path'];
$files = scandir($path);

print_r($files);

答案 1 :(得分:1)

我现在访问值:

  $query = 'UR-000001';
    $path = '/Unfiled Documents';
    $filenames = $client->searchFileNames($path, $query, 10, false);
   echo '<pre>', print_r($filenames[0]), '</pre>';

获得以下输出:

Array
   (
    [rev] => 83527cbf3f
    [thumb_exists] => 
    [path] => /Unfiled Documents/UR-000001 – PLAN – 123432.pdf.txt
    [is_dir] => 
    [client_mtime] => Mon, 02 Jan 2017 13:20:19 +0000
    [icon] => page_white_text
    [read_only] => 
    [modifier] => 
    [bytes] => 0
    [modified] => Tue, 03 Jan 2017 06:54:54 +0000
    [size] => 0 bytes
    [root] => dropbox
    [mime_type] => text/plain
    [revision] => 131
 )
 1