/** * Notes:判断文件是否存在(远程和本地文件) * @param $file string 完整的文件链接 * @return bool */ function check_file_exists($file) { //远程文件 if ('http' == strtolower(substr($file, 0, 4))) { $header = get_headers($file, true); return isset($header[0]) && (strpos($header[0], '200') || strpos($header[0], '304')); } else { return file_exists($file); } }