file_get_contents 超时设置

<?php  

$ctx = stream_context_create(

array(   

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

 )  

);

file_get_contents("http://example.com/", 0, $ctx);  ?>  

 

posted on 2014-01-23 13:17  lsl8966  阅读(162)  评论(0)    收藏  举报