作者:手机用户2702933567 | 来源:互联网 | 2018-07-17 01:09
ec(2);php复制文件functioncopy($from,$to){ if($this->abspath($to)"")$to$this->basedir; if($this->dirname($from)$this->dirname($to))$to
php 复制文件
function copy($from, $to) {
if ($this->abspath($to)=="/") $to=$this->basedir;
if ($this->dirname($from) == $this->dirname($to)) $to = $this->dirname($to).'/复件'.basename($from);
if (!is_dir($from)) {
return @copy($from, $to);
} else {
if (!is_dir($to)) @mkdir($to);
$path = opendir($from);
while( $file = readdir( $path ) ) {
if (($file=='.')||($file=='..')) continue;
if (is_dir($from.'/'.$file)) $this->copy($from.'/'.$file, $to.'/'.$file);
else echo basename($file), copy($from.'/'.$file, $to.'/'.$file) ? ' Success!' : ' False.', '
';
}
return true;
}
}