我有一个codeigniter的控制器功能,可以从gmail中获取邮件。
这需要花费大量时间,所以我需要在后台执行特定的控制器功能,这样用户无需等到所有邮件都被提取。
答案 0 :(得分:0)
Ajax Jquery Way
JS:
$.ajax({
url : "index.php?/MyController/myMethod",
async : true //change this to false if you hate your users and want them to wait
}).done(function() {
alert("EMAIL IS READY! USER DIDN'T WAIT")
});
PHP:
class MyController extends CI_Controller{
function myMethod(){
//do your email stuff
}
//if codgeIgniter V2
function myMethod_get(){
//do your email stuff
}
}