0

我将每 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();
}
4

1 回答 1

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 软件本身允许您限制这一点,我不会感到惊讶。可能想检查一下。

于 2012-05-16T13:29:14.387 回答