Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Laravel读取存储器中的文件_Php_Laravel_Laravel Blade - Fatal编程技术网

Php Laravel读取存储器中的文件

Php Laravel读取存储器中的文件,php,laravel,laravel-blade,Php,Laravel,Laravel Blade,我已将图像保存在存储器中的文件中。我想在控制器中使用exec命令将文件保存到数组中,然后将数组传递到刀片服务器。有什么办法吗 $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 fi

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

$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);
}

然后您可以将图像/文件传递到刀片中。

很抱歉,我误解了您从文件中读取文件名的要求。我不确定你是否希望这样我想把文件保存到一个数组中,你做了什么事情没有?我们能看看你的密码吗?为什么是exec?请查看并确保您采取了相应的措施。这个想法是告诉我们你想做什么,展示你已经尝试了什么,展示你得到了什么结果。