Codeigniter 中的 Cron 作业 [英] Cron jobs in codeigniter

查看:24
本文介绍了Codeigniter 中的 Cron 作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用内置于 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆