复制文件

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); //旧路径 ,新路径 

posted @ 2018-05-11 18:01  SOIQ  阅读(102)  评论(0编辑  收藏  举报