【问题标题】:Laravel Reading files in storage [closed]Laravel 读取存储中的文件 [关闭]
【发布时间】:2019-07-20 01:18:32
【问题描述】:

我已将图像保存在存储中的文件中。我想使用控制器中的 exec 命令将文件保存到数组中,然后将数组传递到刀片中。有什么办法吗?

【问题讨论】:

  • "我想把文件保存到一个数组中" 你有没有做过什么?我们可以看看你的代码吗?为什么exec()
  • 查看How to Ask 并确保您使用tour。我们的想法是告诉我们您想做什么,展示您的尝试,并展示您获得的结果。

标签: php laravel laravel-blade


【解决方案1】:
$images= [];
// $filesInFolder = \File::files('images'); getting files from the folder
$files =  file_get_contents( 'filename' ); // replace here the filename with you full path of the file

foreach($files as $path)
{
   $images[] = pathinfo($path);
}

然后你可以在你的刀片中传递图像/文件。

【讨论】:

  • 抱歉,我误解了您从文件中读取文件名的要求。我不确定你是否希望这样
猜你喜欢
  • 2015-02-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-07-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多