<?php |
$url2 = 'http://yuncode.net/test.jpg' ; |
$ch = curl_init(); |
$timeout = 10; |
curl_setopt ($ch, CURLOPT_URL, $url2); |
curl_setopt($ch, CURLOPT_HEADER, 1); |
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); |
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); |
$contents = curl_exec($ch); |
//echo $contents; |
if (preg_match( "/404/" , $contents)){ |
echo '文件不存在' ; |
} |
?> |