file_exists — 파일 또는 디렉토리가 있는지 여부를 확인합니다. > 개발자팁

개발자팁

개발과 관련된 유용한 정보를 공유하세요.
질문은 QA에서 해주시기 바랍니다.

file_exists — 파일 또는 디렉토리가 있는지 여부를 확인합니다. 정보

PHP file_exists — 파일 또는 디렉토리가 있는지 여부를 확인합니다.

본문

file_exists — 파일 또는 디렉토리가 있는지 여부를 확인합니다.

 

[설명]

bool file_exists ( string $filename )

파일 또는 디렉토리가 있는지 여부를 확인합니다.

 

[인수]

filename

파일 또는 디렉토리의 경로.

 

Windows에서는 // computername / share / filename 또는 \\ computername \ share \ filename을 사용하여 네트워크 공유의 파일을 검사합니다.

 

[반환값]

filename으로 지정된 파일이나 디렉토리가 있으면 TRUE를 반환하고 그렇지 않으면 TRUE를 반환합니다. 그렇지 않으면 FALSE.

 

Example #1 Testing whether a file exists

<?php

$filename = '/path/to/foo.txt';

 

if (file_exists($filename)) {

    echo "The file $filename exists";

} else {

    echo "The file $filename does not exist";

}

?>

추천
0
  • 복사

댓글 0개

© SIRSOFT
현재 페이지 제일 처음으로