简体   繁体   中英

cURL Array from Amazon S3 PHP Class

I'm currently using the Amazon S3 PHP Class, getObjectInfo()

The line I'm using is this:

  $info = $s3->getObjectInfo($bucketName, baseName($uploadFile));
    echo "S3::getObjecInfo(): Info for {$bucketName}/".baseName($uploadFile).': '.print_r($info, 1);

And it returns something like this:

  S3::getObjecInfo(): Info for media/7743247696.mp4: Array ( [time] => 1254199603 [hash] => 99a974c6fe806f63ab7994708ea8484b [type] => video/mp4 [size] => 4562654 ) 

Using PHP, how can I extract one bit at a time, more specifically, to get the [size] attribute so that I can add this to my database?

Looks like this is just an associative array. You can access elements using $arrayName['keyName'] :

$info = $s3->getObjectInfo($bucketName, baseName($uploadFile));
$size = $info['size'];

echo "Size: $size";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM