使用 CodeIgniter 调度函数的执行


Schedule the execution of function using CodeIgniter

我需要每隔几个小时执行一个函数,现在我正在手动执行:

http://www.mywebsite.com/controller/function

例如,有没有办法每四个小时安排一次此函数的执行?

在最好的情况下,您应该在 *NIX 命令行中使用 wget 或 CURL 将 cron 作业设置为每小时请求一次该 URL:

0 1 * * * wget http://www.mywebsite.com/controller/function

由于此 URL 可公开访问,因此使用类似 http://www.mywebsite.com/controller/function?key=my_secret_key_here 的参数对其进行保护

另请查看此在线服务: http://cronless.com/