标签:
<?php // 打开文件 $file = ‘somefile.txt‘; $fp = fopen($file, ‘r‘); // 连接FTP $conn_id = ftp_connect($ftp_server); $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // 上传 if(ftp_fput($conn_id, $file, $fp, FTP_ASCII)) { echo "Successfully uploaded $file\n"; } else { echo "There was a problem while uploading $file\n"; } // 退出 ftp_close($conn_id); fclose($fp); ?>
要使用这些 FTP 相关函数,在编译的时候请添加 --enable-ftp 选项。
标签:
原文地址:http://www.cnblogs.com/xueyuwyz/p/4308136.html