$func = 'image'.$type;
//处理path路径 是否启用随机文件名
if($isRanName)
{
$name = uniqid().'.'.$type;
}else{
$pathinfo = pathinfo($soruce);
//var_dump($pathinfo);
$name = $pathinfo['filename'].'.'.$type;
}
$path = rtrim($path,'/').'/'.$name;
$func($soruceRes,$path);
imagedestroy($soruceRes);
imagedestroy($waterRes);
}
$func = 'image'.$type;
$func($soruceRes,$path);
$func是动态拼接的函数名。