copy

반응형
Programming/PHP

파일 입출력

[php file function] 원본 파일이 존재해야 한다. 복사하기 $file = 'readme.txt'; $newfile = 'test.txt.bak'; // 참일경우 성공, 거짓일경우 실패 // 원본파일 복사할파일 if(!copy($file, $newfile)){ echo "failed to copy $file...\n"; } 삭제하기 // 삭제 unlink('test.txt.bak'); 읽고 쓰기 (fopen도 있음 - https://www.php.net/manual/en/function.fopen) $file = './readme.txt'; //읽기 echo file_get_contents($file); //url로 읽을 수도 있음. //쓰기 file_put_contents($file, 'h..

Conative
'copy' 태그의 글 목록