您好,我在将文件从服务器传输到要复制的服务器时遇到问题像这样的文件:
http://mysite1.com/myfile.jpg <-- 我想要这个复制或通过 ftp 上传到 mysite2.com
例如:http://mysite1.com/myfile.jpg上传到http://mysite2.com/fileuploads/
如何通过 PHP FTP 传输来做到这一点?这里有任何硬编码器可以解决我的问题吗?
这里有一个示例代码,但你应该在提问之前自己阅读并尝试:
<上一页>$connection = ftp_connect($server);$login = ftp_login($connection, $ftp_user_name, $ftp_user_pass);if (!$connection || !$login) { die('连接尝试失败!');}$upload = ftp_put($connection, $dest, $source, $mode);if (!$upload) { echo 'FTP 上传失败!';}ftp_close($connection);希望它可以帮助您入门
Hi I have a problem in transferring file from server to server I want to copy file like:
http://mysite1.com/myfile.jpg <-- I want this to copy or upload via ftp to mysite2.com
For example: http://mysite1.com/myfile.jpg upload to http://mysite2.com/fileuploads/
How to do this via PHP FTP transferring? Any hardcoder here can help my problem?
Well here's one sample code, but you should read and try on your own before asking:
$connection = ftp_connect($server); $login = ftp_login($connection, $ftp_user_name, $ftp_user_pass); if (!$connection || !$login) { die('Connection attempt failed!'); } $upload = ftp_put($connection, $dest, $source, $mode); if (!$upload) { echo 'FTP upload failed!'; } ftp_close($connection);
Hope it helps you getting started
这篇关于php 通过 FTP 将文件从服务器上传到另一个服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!