file_get_content() 超时

set_time_limit 只能影响php 程序的超时时间。
file_get_contents 读取的是URL的超时时间。
 
因此 set_limit_limit 对file_get_contents 是无效的。
 
<?php

$opt =array(
    'http'=>array(
        'method'=>'GET',
        'timeout'=>60,
        )
    );

$context =stream_context_create($opt);

$html=file_get_contents('http://www.baidu.com',false,$context);

fpassthru($fp);

 

posted @ 2014-11-17 15:49  BiuBiuBiu666  阅读(225)  评论(0编辑  收藏  举报