$ch = curl_init($url);//设置需要获取的URL地址,或者$ch=curl_init(); curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_NOSIGNAL, true); //注意,毫秒超时一定要设置这个
curl_setopt($ch, CURLOPT_TIMEOUT_MS, 100); //超时时间100毫秒
curl_exec($ch);
curl_close($ch);
已有 0 条评论