我尝试检查是否存在于其他文件中,如果文件存在服务器响应HTTP 200 (如果不是HTTP 302 )。现在,我尝试使用get_headers()函数进行检查,但是它会变慢,因为文件大小约为2mb-10mb,我在一段时间内检查了大约20个文件,它花费了大约5-10秒。也许还有其他选择?
发布于 2013-10-21 14:10:27
尝试在CURLOPT_NOBODY选项中使用curl。
示例:
$ch = curl_init("http://www.other-server.com/file.jpg");
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_exec($ch);
$response_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);$response_code将包含HTTP代码。
https://stackoverflow.com/questions/19496599
复制相似问题