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

查看:150
本文介绍了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天全站免登陆