【发布时间】:2011-08-22 02:09:31
【问题描述】:
我在 XAMPP 和 Windows 中使用以下函数。但我不断收到“致命错误:超过 30 秒的最大执行时间”
有什么建议吗?
function is_404($url) {
$handle = curl_init($url);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($handle, CURLOPT_TIMEOUT,10);
curl_setopt($handle, CURLOPT_CONNECTTIMEOUT,10);
/* Get the HTML or whatever is linked in $url. */
$response = curl_exec($handle);
/* Check for 404 (file not found). */
$httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);
/* If the document has loaded successfully without any redirection or error */
if ($httpCode >= 200 && $httpCode < 300) {
return false;
} else {
return true;
}
}
【问题讨论】:
标签: php windows curl timeout xampp