我正在尝试使用 ftp 服务器附加文件
file_put_contents("ftp://".$ftp_user_name.":".$ftp_user_pass."@".$ftp_server."/".$destFile, $outputStr, FILE_APPEND)
这工作正常,但需要很长时间才能在失败时生成超时。我想设置在 FTP 上附加文件的超时时间。我查看了stream_context_create(),它确实支持FTP协议(protocol),但找不到连接超时的选项,就像HTTP协议(protocol)一样。设置 file_put_contents 或 file_get_contents 超时的其他方法可能是什么
最佳答案
也许这会有帮助?
ini_set("default_socket_timeout", $seconds);
关于php - file_get_contents 和 file_put_contents 的 FTP 超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15154975/