Home  >  Article  >  Backend Development  >  php怎么判断远程文件是否存在

php怎么判断远程文件是否存在

WBOY
WBOYOriginal
2016-06-13 11:50:21876browse

php怎样判断远程文件是否存在
php 有什么方法  来判断远程文件是否存在
------解决方案--------------------

$url = 'http://www.example.com';<br /><br />print_r(get_headers($url));<br /><br />print_r(get_headers($url, 1));


获取远程文件HEAD信息。如果等于HTTP/1.1 200 OK 则证明文件存在

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn