$url = 'http://www.google.com.hk';
$opts = array(
'http' => array(
'timeout' => 3,
)
);
$context = stream_context_create($opts);
$n = 0;
while ($n < 5 && ($result = file_get_contents($url, false, $context)) === FALSE) {
$n++;
}
file_get_contents超时设置时间
最新推荐文章于 2023-09-01 11:57:32 发布