<?php// open some file for reading $file = 'somefile.txt'; $fp = fopen($file, 'r');// connect to the server $conn_id = ftp_connect($ftp_server); $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);// try to upload the file if(ftp_fput($conn_id, $file, $fp, FTP_ASCII)) { echo "Successfully uploaded $file\n"; } else { echo "There was a problem while uploading $file\n"; }// close the connection and the file handler ftp_close($conn_id); fclose($fp);?>
$file = 'somefile.txt';
$fp = fopen($file, 'r');// connect to the server
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);// try to upload the file
if(ftp_fput($conn_id, $file, $fp, FTP_ASCII)) {
echo "Successfully uploaded $file\n";
} else {
echo "There was a problem while uploading $file\n";
}// close the connection and the file handler
ftp_close($conn_id);
fclose($fp);?>
具体你要自己去看 手册上 的FTP函数部分!
比如,操作apache的日志文件,我用php来做分析,为了减轻数据库的负担,网站部分页面的统计直接从日志里分析得到.这样子也要用ftp函数嘛?应该不用的吧。
说简单一点就是用php分析日志文件(日志比较大:三台服务器,每天三个文件加一起基本350M的)
要从里面取出来特定几个页面的访问量,以及来路,IP,日期==这类的信息
你可以考虑做文件散列