file_get_contents防止超时

发布时间:2021-07-14 18:18:58 阅读:1063次

 解决file_get_contents超时

  1. <?php  
  2. $ctx = stream_context_create(array(  
  3.    'http' => array(  
  4.        'timeout' => 1 //设置一个超时时间,单位为秒  
  5.        )  
  6.    )  
  7. );  
  8. file_get_contents("http://example.com/", 0, $ctx);  
  9. ?>  

如有问题,可以QQ搜索群1028468525加入群聊,欢迎一起研究技术

支付宝 微信

有疑问联系站长,请联系QQ:QQ咨询

转载请注明:file_get_contents防止超时 出自老鄢博客 | 欢迎分享