I use Dropbox API and I need to list all files inside a folder , when I use metaData method using var_dump();
like : var_dump($metaData);
I get these:
object(stdClass)#26 (9) {
["hash"]=> string(32) "d36517b72d827dc28b1e0681a23e463a"
["thumb_exists"]=> bool(false)
["bytes"]=> int(0)
["path"]=> string(1) "/"
["is_dir"]=> bool(true)
["size"]=> string(7) "0 bytes"
["root"]=> string(10) "app_folder"
["contents"]=> array(1) {
[0]=> object(stdClass)#27 (12) {
["revision"]=> int(1)
["rev"]=> string(9) "10815f504"
["thumb_exists"]=> bool(false)
["bytes"]=> int(7332680)
["modified"]=> string(31) "Sun, 03 Jun 2012 17:51:47 +0000"
["client_mtime"]=> string(31) "Sun, 03 Jun 2012 17:51:47 +0000"
["path"]=> string(9) "/etmh.pdf"
["is_dir"]=> bool(false)
["icon"]=> string(18) "page_white_acrobat"
["root"]=> string(7) "dropbox"
["mime_type"]=> string(15) "application/pdf"
["size"]=> string(4) "7 MB"
}
}
["icon"]=> string(6) "folder"
}
How can I deal with these data , for example I need to list all files in this folder
, now , there is only one file in the example above ([“path”]=> string(9) “/etmh.pdf” :: [“mime_type”]=> string(15) “application/pdf” )
I need some thing like foreach to get and deal with all data ..
Thank you ..
You can use the function
get_object_vars()to extract variables from an object.Documentation link http://de.php.net/manual/en/function.get-object-vars.php