codeigniter中的Cron作业 [英] Cron jobs in codeigniter
问题描述
我想用一个内置在CodeIgniter的网站做一个cron工作 - 我有进入CPanel cron功能,任何人都可以建议最好的方式使用CPanel设置cron工作?
I am trying to do a cron job with a site built in CodeIgniter - I've got access to the CPanel cron feature can anyone suggest the best way to setup a cron job using CPanel?
我使用CodIgniter,因此无法确定如何在cron作业中调用控制器。
I am using CodIgniter so cannot be sure how to call a controller within a cron job?
例如 http: /admin.com/sites/publish/
如何使用cron作业在站点控制器中访问此发布功能?
How would I access this publish function within the sites controllers using a cron job?
推荐答案
最好的方法是从cron作业中的命令行调用...
Best way is to call from the command line in the cron job...
php /path/to/index.php controller >> /dev/null
您可以通过CI中的命令行运行控制器,参见此处。
You can run controllers via the command line in CI, see here.
这篇关于codeigniter中的Cron作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!