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

 

相关文章:

  • 2021-09-24
  • 2021-08-30
  • 2022-12-23
  • 2021-05-17
  • 2021-09-23
  • 2021-08-25
猜你喜欢
  • 2021-12-13
  • 2022-12-23
  • 2021-09-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案