다른 url에 있는 파일 존재여부
2008. 5. 14. 16:04 |
### 프로그래밍/PHP
다른 url에 있는 파일 존재여부
파일 존재여부 file_exists는 상대디렉토리를 이용해 파일의 존재여부를 알아낸다.
url을 이용해서 알아볼려면 아래 처럼 하면된다.
$imgpath = "http://hoooow.tistory.com/data/img.gif";
$file_headers = @get_headers($imgpath);
if($file_headers[0] == 'HTTP/1.1 404 Not Found'){"이미지 파일이 없다~";}
파일 존재여부 file_exists는 상대디렉토리를 이용해 파일의 존재여부를 알아낸다.
url을 이용해서 알아볼려면 아래 처럼 하면된다.
$imgpath = "http://hoooow.tistory.com/data/img.gif";
$file_headers = @get_headers($imgpath);
if($file_headers[0] == 'HTTP/1.1 404 Not Found'){"이미지 파일이 없다~";}