file_get_contents超时设置
// Create the stream context
$context = stream_context_create(array(
'http' => array(
'timeout' => 3000 //超时时间,单位为秒
)
));
// Fetch the URL's contents
$contents = file_get_contents('http://sample.com', 0, $context);
参考:http://www.acwind.net/blog/archives/1269