file_get_contents函数在访问大文件时,会报错504超时,下面分享下我的站长站的解决方法。
$opts = array(
'http'=>array(
'method'=>"GET",
'timeout'=>60,
)
);
$context = stream_context_create($opts);
$html =file_get_contents('https://www.51yma.cn', false, $context);这样,file_get_contents获取数据时,超出60秒将会自动退出。
