file_get_contents 超时设置

<?php  

$ctx = stream_context_create(

array(   

  'http' => array(   'timeout' => 1 //设置一个超时时间,单位为秒      )

 )  

);

file_get_contents("http://example.com/", 0, $ctx);  ?>  
现主要从事PHP、Uinx/Linux、C/C++等方面的项目开发。
原文地址:https://www.cnblogs.com/lsl8966/p/3531014.html