开发者

Persistent FTP connection with file wrapper in php

If I do something like that:

rename('ftp://user:password@example.com/pub/file1.txt','ftp://user:password@example.com/pub/fileA.txt');
rename('ftp://user:password@example.com/pub/file2.txt','ftp://user:password@example.com/pub/fileB.txt');
rename('ftp://user:password@example.com/pub/file3.txt','ftp://user:password@example.com/pub/fileC.txt');
rm('ftp://user:password@example.com/pub/fileA.txt');
rm('ftp://user:password@example.com/pub/fileB.txt');
rm('ftp://user:password@example.com/pub/fileC.txt');

will php keep ftp connection between different operations on the same server? In other words I wonder if in such case php creates separate connection or keeps it alive? And if it creates separate connections then how could force it to use one when I transfer files开发者_如何学C using file wrappers. I know I could use different methods instead of ftp wrapper but I want to know how this works with file wrappers.


Just been looking at it with Wireshark and the answer is definitely No. Tested with PHP/5.2.19-win32.

As Robik suggests use the PHP FTP extension if you want connection persistence.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜