复制文件

function file2dir($sourcefile, $dir){
  if(!file_exists($sourcefile)){
    return false;
  }
  if(!is_dir(dirname($dir))){
    mkdir(dirname($dir), 0777, true);
  }
  return copy($sourcefile, $dir);
}

$this->file2dir($old_path_file,$new_path_file); //旧路径 ,新路径 

原文地址:https://www.cnblogs.com/soiq-1123/p/9026008.html