【问题标题】:FTP Timeout for file_get_contents & file_put_contentsfile_get_contents 和 file_put_contents 的 FTP 超时
【发布时间】:2013-02-15 18:59:40
【问题描述】:

我正在尝试在 ftp 服务器上附加文件

file_put_contents("ftp://".$ftp_user_name.":".$ftp_user_pass."@".$ftp_server."/".$destFile, $outputStr, FILE_APPEND)

这很好用,但需要很长时间才能在失败时生成超时。我想设置在 FTP 上附加文件的超时时间。我查看了支持 FTP 协议但找不到连接超时选项的 stream_context_create() ,就像它用于 HTTP 协议一样。为 file_put_contents 或 file_get_contents 设置超时的另一种方法是什么

【问题讨论】:

    标签: php file ftp timeout file-get-contents


    【解决方案1】:

    也许这会有所帮助?

    ini_set("default_socket_timeout", $seconds);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-06-22
      • 1970-01-01
      • 2013-06-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-28
      相关资源
      最近更新 更多