如果希望php访问一下网址,但不需要返回结果,如:需要执行很长时间的页面,不用等待返回结果,只需要执行了就可以了,办法之一:
使用CURL需要设置CUROPT_TIMEOUT为1(最小为1)。也就是说,客户端至少必须等待1秒钟。

 

public function set_cache_log(){
        $host = "https://****.com.cn/index.php?s=/moudle/controller/function/id/12";
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $host);
        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);
    }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-21
  • 2021-11-06
  • 2021-07-29
  • 2021-09-14
  • 2021-08-29
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-19
  • 2021-10-13
  • 2022-12-23
相关资源
相似解决方案