PHP 파일삭제 함수 unlink()

Jmnote (토론 | 기여)님의 2023년 2월 12일 (일) 19:17 판 (→‎예제)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요[ | ]

PHP unlink()
  • 파일을 삭제하는 PHP 함수
  • 성공하면 true, 실패하면 false를 반환하다.
unlink('path/file.txt');
if( !unlink('path/file.txt') ) {
  echo "failed\n";
}
else {
  echo "success\n";
}

2 예제[ | ]

$fh = fopen('test.text', 'a');
fwrite($fh, 'Hello World');
fclose($fh);
unlink('test.txt');

3 같이 보기[ | ]

4 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}