php curl实现读取url不等待返回结果
如果希望php访问一下网址,但不需要返回结果,如:需要执行很长时间的页面,不用等待返回结果,只需要执行了就可以了curl_setopt($ch, CURLOPT_TIMEOUT, 1);把这个设置成1秒后超时就可以了
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/test2.php");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 1);
$content=curl_exec($ch);
curl_close($ch);
echo $content;
页:
[1]