我一直在设计一个简单的备份管理器脚本。它的主要功能是只需点击一下ftp即可将备份文件发送到另一个目的地。
我一直使用以下链接将备份详细信息发送到 ftp.php 文件:
<a href=\"ftp.php?name=$name&file=$location\"><img src=\"./move.png\"></a>
FTP.php文件是:
<?php
$name = $_GET['name'];
$file = $_GET['file'];
/* Remote File Name and Path */
$remote_file = "/$name";
/* File and path to send to remote FTP server */
$local_file = './$file';
/* FTP Account (Remote Server) */
$ftp_host = 'ftp.domain.com'; /* host */
$ftp_user_name = 'username'; /* username */
$ftp_user_pass = 'pass'; /* password */
/* File and path to send to remote FTP server */
/* Connect using basic FTP */
$connect_it = ftp_connect( $ftp_host );
/* Login to FTP */
$login_result = ftp_login( $connect_it, $ftp_user_name, $ftp_user_pass );
/* Send $local_file to FTP */
if ( ftp_put( $connect_it, $remote_file, $file, FTP_BINARY ) ) {
echo "WOOT! Successfully transfer $local_file\n";
}
else {
echo "Doh! There was a problem\n";
}
/* Close the connection */
ftp_close( $connect_it );
?>
所以我想在单页上运行整个脚本并获得ftp响应&#34; WOOT!成功转移$ local_file \ n&#34;或在主页本身失败..
任何人?