我将每10秒运行一次cron作业来连接和复制文件然后删除。 我不会在复制文件的同时运行cron等等,这是最好的方法吗?
我可以限制已连接的用户吗?
try {
$con = ftp_connect($server);
if (false === $con) {
throw new Exception('Unable to connect');
}
$loggedIn = ftp_login($con, $username, $password);
if (true === $loggedIn) {
echo 'Success!';
} else {
throw new Exception('Unable to log in');
}
print_r(ftp_nlist($con, "."));
ftp_close($con);
} catch (Exception $e) {
echo "Failure: " . $e->getMessage();
}
答案 0 :(得分:1)
if a certain file doesnt exist
make the file
do stuff
delete file
else if the file exists, but its very old
recreate the file
do stuff
delete file
else
its busy
如果ftp软件本身允许你限制它,我不会感到惊讶。可能想检查一下。