php - How to get array of key from amazon s3 object -
i using amazon s3 v3 php sdk , trying key of object using
s3->listobjects([ 'bucket' => $somebucketname]);
this function working fine , getting object under $somebucketname
bucket , in below form
aws\result object ( [data:aws\result:private] => array ( [istruncated] => [marker] => [contents] => array ( [0] => array ( [key] => 1.png [lastmodified] => aws\api\datetimeresult object ( [date] => 2015-07-14 07:22:25.000000 [timezone_type] => 2 [timezone] => z ) [etag] => "23f423234v23v42424d23" [size] => 19980 [storageclass] => standard [owner] => array ( [displayname] => sfsfssfsdf [id] => 242f2342242342252g42f42vt34 ) ) [1] => array ( [key] => 58.jpg [lastmodified] => aws\api\datetimeresult object ( [date] => 2015-07-14 07:20:26.000000 [timezone_type] => 2 [timezone] => z ) [etag] => "vrtet4v4t54tvt4gvtgv45" [size] => 1226694 [storageclass] => standard [owner] => array ( [displayname] => sfsfssfsdf [id] => 34t3t3t3y43y4yg5yy4vg6u676 ) ) [2] => array ( [key] => hdfhdfhdfhdfhfhfh [lastmodified] => aws\api\datetimeresult object ( [date] => 2015-07-30 12:07:42.000000 [timezone_type] => 2 [timezone] => z ) [etag] => "3453345343rcf3f3r3r3f" ) [name] => sfssd [prefix] => [maxkeys] => 1000 [@metadata] => array ( [statuscode] => 200 [effectiveuri] => https://s3-us-west-2.amazonaws.com/sfssd [headers] => array ( [x-amz-id-2] => sdfsfs234sfs [x-amz-request-id] => hsjfsd899 [date] => mon, 03 aug 2015 06:46:48 gmt [x-amz-bucket-region] => us-west-2 [content-type] => application/xml [transfer-encoding] => chunked [server] => amazons3 ) ) ) )
now question how array of key below above object
array("1.png","58.jpg","hddhdfhdhdgh);
aws\result
implements arrayaccess
. can access contents so:
$result = $s3->listobjects(['bucket' => $somebucketname]) $contents = $result['contents'];
Comments
Post a Comment