标签:
file_get_contents在某些情况下会出错。
这样在运行中会时不时的出现上述错误,我也换过file_get_contents等其他函数都没用,在网上查阅后发现用CURL方法抓取不会出错
$url = "http://www.php100.com/logo.gif";
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT,10);
$img = curl_exec($ch);
标签:
原文地址:http://www.cnblogs.com/prolovecui/p/4595915.html