简体   繁体   English

如何仅从 amazon s3 laravel 获取图像的文件名

[英]how to get filenames only of images from amazon s3 laravel

I want to get only names of files from server s3 amazon.我只想从服务器 s3 amazon 获取文件名。 i am doing like that我就是这样做的

$files = \Storage::files('app/public/');

but this gives me all the files but i dont want to bring images with it but only thier names.但这给了我所有的文件,但我不想带图片,只带他们的名字。

If you wanna get the name of all files in that folder you can do like this:如果您想获取该文件夹中所有文件的名称,您可以这样做:

$filesName = [];

$allFiles = \File::allFiles(public_path());

foreach($allFiles as $file) {

   array_push($filesName, $file->getFilename())

}

print_r($fileNames);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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