Home > Backend Development > PHP Tutorial > PHP rename and copy files_PHP tutorial

PHP rename and copy files_PHP tutorial

WBOY
Release: 2016-07-20 11:06:35
Original
1023 people have browsed it

php rename and copy files
$nname = $nowpath.$newfilename;
if (file_exists($nname) || !file_exists($oldname)) {
m($nname.' The target file already exists or the original file does not exist');
} else {
m(basename($oldname).' Rename'.basename($nname).(@rename($oldname,$nname) ? 'Success' : 'Failure'));
}
}

// Copy file
elseif ($sname && $tofile) {
if (file_exists($tofile ) || !file_exists($sname)) {
m('The target file already exists or the original file does not exist');
} else {
m(basename($tofile).' copied '. (@copy($sname,$tofile) ? basename($tofile).' Success' : 'Failure'));
}


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445025.htmlTechArticlephp Rename and copy files $nname = $nowpath.$newfilename; if (file_exists($nname) || !file_exists($oldname)) { m($nname.' The target file already exists or the original file does not exist');...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template