개발/php
php 파일 복사
철권
2018. 7. 23. 17:34
728x90
<?php
// test.php파일을 복사본 test.php.bak로 만듭니다.
$oldfile = 'test.php'; // 원본파일
$newfile = 'test.php.bak'; // 복사파일
// 실제 존재하는 파일인지 체크...
if(file_exists($oldfile)) {
if(!copy($oldfile, $newfile)) {
echo "파일 복사 실패";
} else if(file_exists($newfile)) {
echo "파일 복사 성공";
}
}
?>
728x90
반응형