//上传图片
public function upload(){
$file = request()->file('img');
// 移动到框架应用根目录/static/uploads/ 目录下
$info = $file->move(ROOT_PATH . 'public' . DS . 'static'. DS . 'uploads');
if($info){
return $info->getSaveName();
}else{
echo $file->getError();
exit();
}
设置图片上传方法 移动到指定文件夹下 获取 完整图片路径
//处理图片上传
if($_FILES['img']['tmp_name']){
$data['img']=$this->upload();
}
判断是否为空 不为空引入方法 $this->uploda();