刚接触TP5不知道是不是我个人的问题
我在TP的包里面也没发现image类 不知道是不是理解错了 求大神指导
$filepath = input('post.filepath');
$filepath?$filepath = DS . $filepath:'';
$waterMark = input('post.waterMark');
// 获取表单上传文件
$file = request()->file('image');
// 移动到框架应用根目录/public/uploads/ 目录下
$info = $file->move(ROOT_PATH . 'public' . DS . 'uploads' . $filepath);
if($info){
$imgSrc = ROOT_PATH . 'public' . DS . 'uploads' . $filepath .$info->getSaveName();
if(!$waterMark){
$image = \think\Image::open($imgSrc);
$image->water(__STATIC__ .'/common/img/logo.png')->save($imgSrc);
}
return out_data($imgSrc);
}else{
// 上传失败获取错误信息
echo $file->getError();
}
最佳答案
