反正有cakephp在指定時間內發送電子郵件嗎?Cakephp電子郵件幾秒/分鐘後
我有一個文件上傳網站建立使用cakephp,它完成上傳後將發送一個電子郵件下載鏈接,然後它會調用一個PHP CLI來壓縮文件。在壓縮過程中,網站已經關閉,所以我不知道壓縮過程何時完成。我想知道是否可以在cakephp電子郵件中指定,例如在1分鐘後發送電子郵件,在頁面刷新之前。
這是一些代碼來顯示發生了什麼
var xhr_zip;
xhr_zip = new XMLHttpRequest();
fd_zip = new FormData();
fd_zip.append("total_files", total_files);
xhr_zip.open("POST", "datas/zip/", true);
xhr_zip.send(fd_zip);
xhr_update_usage = new XMLHttpRequest();
fd_update_usage = new FormData();
xhr_update_usage.open("POST", "datas/update_usage/", true);
xhr_update_usage.send(fd_update_usage);
xhr_email = new XMLHttpRequest();
fd_email = new FormData();
xhr_email.open("POST", "datas/send_link/" + recipient + '/' + subject, true);
xhr_email.send(fd_email);
xhr_email.onload = function(e) {
setTimeout(function() {
$("body").removeClass("loading");
window.onbeforeunload = null;
alert("Total Files : " + total_files + " Sent \n Total Upload Size : " + (total_upload_size/1048576).toFixed(2) + " MB");
document.location.reload(true);
}, 2000);
};
所以,拉鍊觸發後,即使它不能完成荏苒,該腳本將移動到發送電子郵件,並刷新瀏覽器。
爲什麼不在壓縮後發送郵件 – 2013-04-16 22:00:49
@Dagon,因爲壓縮是通過php完成的,而通過CakePHP發送電子郵件。它就像2個不同的應用程序。所以,如果我必須在壓縮後執行此操作,則需要將代碼移到標準的PHP代碼中,我試圖不去做 – Harts
蛋糕是一個框架,而不是另一種語言。 – 2013-04-16 22:33:03