刮刮后端接口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
781 B

<?php
namespace app\logic;
use think\facade\Filesystem;
class Upload
{
/**
* 图片上传
* @param $file
* @param $path
* @return bool|string
*/
public static function uploadImage($file,$path = 'topic')
{
// 上传到本地服务器
// $file = request()->file('image');
return Filesystem::putFile( $path, $file);
}
/**
* 多图片上传
* @param array $files
* @param $path
* @return array
*/
public static function uploadImageAll(array $files,$path = 'topic')
{
//$files = request()->file('image');
$saveName = [];
foreach($files as $file){
$saveName[] = Filesystem::putFile( $path, $file);
}
return $saveName;
}
}