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

设置一个超时时间就可以,可以自行封装函数

相关文章:

  • 2022-01-20
  • 2022-12-23
  • 2022-12-23
  • 2017-12-14
  • 2022-12-23
  • 2022-02-06
  • 2022-12-23
猜你喜欢
  • 2021-07-29
  • 2022-12-23
  • 2021-04-19
  • 2022-12-23
  • 2022-02-07
  • 2021-07-30
相关资源
相似解决方案