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);
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);