多图片上传

public function Goods_Upload(Request $request)
{
$save_path = 'uploads/' . date("Ymd");


if (!file_exists($save_path)) {
mkdir($save_path, 0777, true);
}

for ($i = 0; $i < count($_FILES['file']['tmp_name']); $i++) {

$upfile = $save_path . "/" . time() . $_FILES['file']['name'][$i];//此处路径换成你的

if (move_uploaded_file($_FILES['file']['tmp_name'][$i], $upfile)) {
$tmp[] = $upfile;
}
}
return rsp("200", "成功", $tmp);
}
posted @ 2021-06-29 14:23  php毛宏历的博客  阅读(32)  评论(0编辑  收藏  举报