首页
学习
活动
专区
圈层
工具
发布
  • 您找到你想要的搜索结果了吗?
    是的
    没有找到

    file_get_contents()函数超时处理方法

    file_get_contents — 将整个文件读入一个字符串 string file_get_contents ( string $filename [, bool $use_include_path...在获取文件的 时候,可能会因为网络等因素,造成获取失败,这里介绍两种方法进行解决 一.增加超时的时间限制  这里需要注意:set_time_limit只是设置你的PHP程序的超时时间,而不是file_get_contents...真正的修改 file_get_contents延时可以用resource $context的timeout参数:  其中,stream_context_create 作用:创建并返回一个文本数据流并应用各种选项,可用于fopen(),file_get_contents()等过程的超时设置、代理服务器、请求方式、头信息设置的特殊过程...php $cnt=0; while($cnt file_get_contents('http...'))===FALSE) {   $cnt++; } ?

    1.5K70
    领券