我需要在我的 S3 上显示存储桶内容,并且我正在使用 Amazon 的 PHP SDK。我的代码很简单
$objects = $s3->list_objects("mybucket",array("max-keys"=>5));
var_dump($objects);
我从服务器得到的响应对我来说非常复杂 - 它的本质是
Object(CFResponse)[107]
public 'header' =>
array (size=11)
'x-amz-id-2' => string
...
public 'body' =>
object(CFSimpleXML)[106]
public '@attributes' =>
array (size=1)
'ns' => string 'http://s3.amazonaws.com/doc/2006-03-01/' (length=39)
public 'Name' => string 'cdneu.2yourfacecdn.com' (length=22)
public 'Prefix' =>
object(CFSimpleXML)[3]
public 'Marker' =>
object(CFSimpleXML)[105]
public 'MaxKeys' => string '5' (length=1)
public 'IsTruncated' => string 'true' (length=4)
public 'Contents' =>
array (size=5)
0 =>
object(CFSimpleXML)[104]
...
1 =>
object(CFSimpleXML)[103]
...
2 =>
object(CFSimpleXML)[102]
...
3 =>
object(CFSimpleXML)[101]
...
4 =>
object(CFSimpleXML)[100]
...
public 'status' => int 200
我相信“内容”下的部分是我正在寻找的,但我如何访问它?我习惯于接收数组,在那里我可以弄清楚键是什么以及如何访问,但这对我来说很难,有什么猜测吗?