Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/241.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php中带有文件包装器的持久FTP连接_Php_Ftp - Fatal编程技术网

php中带有文件包装器的持久FTP连接

php中带有文件包装器的持久FTP连接,php,ftp,Php,Ftp,如果我这样做: 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@exam

如果我这样做:

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');

php会在同一服务器上的不同操作之间保持ftp连接吗?换句话说,我想知道在这种情况下,php是创建单独的连接还是保持它的活性?如果它创建了单独的连接,那么当我使用文件包装器传输文件时,它怎么能强制使用一个连接呢。我知道我可以使用不同的方法来代替ftp包装器,但我想知道如何使用文件包装器。

刚刚使用Wireshark进行了研究,答案肯定是否定的。使用PHP/5.2.19-win32进行了测试


正如Robik建议的那样,如果您想要连接持久性,请使用PHP。

可能不是。尝试使用PHP的问题是我不想更改整个代码,特别是当前的方法允许我轻松地在ftp或sftp(ssh2.sftp://)之间切换。更改此类将需要大量工作。感谢您的检查,但主要问题是是否可以在不退出url样式协议的情况下更改该行为。所以我现在把问题留待讨论。你们可以很容易地做到这一点。。。