一.增加超时的时间限制
这里需要注意:set_time_limit只是设置你的PHP程序的超时时间,而不是file_get_contents函数读取URL的超时时间。真正的修改 file_get_contents延时可以用resource $context的timeout参数:
复制代码 代码如下:
$opts = array(
'http'=>array(
'method'=>"GET",
'timeout'=>60,
) );
$context = stream_context_create($opts); $html =file_get_contents('http://', $data);
