0
我想写一个上传函数,返回上传文件的位置。该位置将被用于调用Imagick类的函数中,以重新调整图像几次以用于响应式设计。唯一的问题是......我没有从return语句中得到任何答案,也找不到原因。 Heeeelp! *在我剜了我的眼睛函数不返回变量
HERE'S *
function imageResize($image){
//call to imagick class and resize functions will go here
echo 'the image to be resized is : '.$image;
}
function file_upload(){
if(!empty($_FILES)){
$tmpFldr=$_FILES['upFile']['tmp_name'];
$fileDest='users/uploads/'.$_FILES['upFile']['name'];
if(move_uploaded_file($tmpFldr,$fileDest)){
echo 'Congratulations, your folder was uploaded successfully';
}
else{
echo 'Your file failed to upload<br><br>';
}
return $fileDest;
} else{die('Nothing to upload');}
} /*End file upload function */
file_upload();
imageResize($fileDest);
在'if'语句中返回通常不是一个好主意,你最好使用一个变量来存储你想返回的结果,并在函数结尾处返回该变量。 – lascort