//接受前台传来的file文件 $file = Request::file(‘file_upload‘); //验证文件规则 $result=validate([‘file‘ => [‘fileSize:102400,fileExt:gif,jpg,png‘]])->check([‘file‘ => $file]); if($result){ //上传到服务器, $path = Filesystem::disk(‘public‘)->putFile(‘upload‘,$file); //结果是 $path = upload/20200825\***.jpg //图片路径,Filesystem::getDiskConfig(‘public‘,‘url‘)功能是获取public目录下的storage, $picCover = Filesystem::getDiskConfig(‘public‘,‘url‘).‘/‘.str_replace(‘\\‘,‘/‘,$path); //结果是 $picCover = storage/upload/20200825/***.jpg //获取图片名称 $fileName = $file->getOriginalName(); }