该函数是否会暂停 php 脚本,直到它在 s3 服务器上找到对象?
我把它放在一个 foreach 循环中,一张一张地上传图片。找到对象后,我调用一个方法在本地删除图像,如果为空则删除本地文件夹。这是一种正确的方法吗?谢谢
foreach ($fileNames as $fileName)
{
$imgSize = getimagesize($folderPath . $fileName);
$width = (string)$imgSize[0];
$height = (string)$imgSize[1];
//upload the images
$result = $S3->putObject(array(
'ACL' => 'public-read',
'Bucket' => $bucket,
'Key' => $keyPrefix . $fileName,
'SourceFile' => $folderPath . $fileName,
'Metadata' => array(
'w' => $width,
'h' => $height
)
));
$S3->waitUntilObjectExists(array(
'Bucket' => $bucket,
'Key' => $keyPrefix . $fileName));
$this->deleteStoreDirectory($folderPath, $fileName);
}