PHP 주요레퍼런스/파일 시스템 함수

copy

웹 개발자의 비상 2011. 8. 6. 19:02
bool copy(string source, string dest)
파일을 복사한다.

source를 dest로 복사하고 그결과에 따라 TRUE 또는 FALSE 값을 반환한다.

예제

<?
$source = "message.txt";
$dest = "message_copy.txt";

// message.txt 파일을 files 디렉토리에 복사한다.
if(!copy($source, $dest)) {
die("파일을 복사하지 못했습니다.");
} else {
echo "파일을 정상적으로 복사하였습니다.";
}
?>

728x90

'PHP 주요레퍼런스 > 파일 시스템 함수' 카테고리의 다른 글

unlink  (0) 2011.08.08
rename  (0) 2011.08.08
is_writable  (0) 2011.08.06
is_readable  (0) 2011.08.06
is_executable  (0) 2011.08.06