php - 数组值的 Laravel 文件扩展名

标签 php mysql laravel laravel-5

我正在尝试从多文件输入数组中获取文件的文件扩展名。

我尝试使用 File::extension() 但它需要一个字符串,而我有一个数组。

我不需要这个值进行验证,因此我无法使用 Laravel 验证。谢谢

最佳答案

I am trying to get the file extension of the files from the multiple file input array.

然后循环遍历 $_FILES 数组。

foreach ($_FILES as $key => $file) {
    $extensions[$key] = \File::extension($file['name']);
}

上面假设没有花哨/固执的 $_FILES 结构突变;p

关于php - 数组值的 Laravel 文件扩展名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46253728/

相关文章:

laravel - 只显示集合名称?

php - 构造函数依赖注入(inject)如何在 Laravel 中工作?

php - 函数(Crawler $node)symfony使用值的问题

MySQL 在两个端口上使用 IPTables - 自访问

php - Symfony2 - 如何在提交表单后从唯一约束错误中恢复?

php - 跟踪成员(member)完成的挑战/目标的最佳方式?

php - 测试用户是否登录 laravel 5.7

php - Guzzle 6 - Promises - 捕获异常

php - 将随机文件下载为 zip

php - laravel-ide-helper 的问题