2013-03-01 66 views
2

我试图用FTP超时的file_get_contents和file_put_contents

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

这工作得很好追加FTP服务器上的文件,但它需要花费大量的时间来产生失败的超时。我想设置在FTP上附加文件的时间。我看了一下stream_context_create(),它支持FTP协议,但找不到连接超时的选项,就像HTTP协议一样。什么可能是其他方式设置超时file_put_contents或file_get_contents

回答

2

也许这会帮助吗?

ini_set("default_socket_timeout", $seconds);