Home > Backend Development > PHP Tutorial > php判断远路文件是否存在

php判断远路文件是否存在

WBOY
Release: 2016-06-13 13:19:41
Original
846 people have browsed it

php判断远程文件是否存在

//判断远程文件是否存在
function remote_file_exists($url) {
	$executeTime = ini_get('max_execution_time');
	ini_set('max_execution_time', 0);
	$headers = @get_headers($url);
	ini_set('max_execution_time', $executeTime);
	if ($headers) {
		$head = explode(' ', $headers[0]);
		if ( !empty($head[1]) && intval($head[1]) < 400) return true;
	}
	return false;
}
Copy after login

?

神奇的iteye,居然有两个empty,无语了.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template