简体   繁体   中英

Cron Job in codeigniter

I want to create and use cron job . But i want it to be done by my script in codeigniter. So is it possible to add a cronjob for a perticualr time when my conrtoller function is completed ?

If so please help... Thank you

Sure you can!

You can execute any controller/action in codeigniter on command line this way:

php index.php controller_name action_name

So you can point a cron job on this particular route and execute anything that don't depends on browser (like sessions/cookies) into your job.

More info: http://www.codeigniter.com/user_guide/general/cli.html

您可以在cron作业中使用curl在cron作业中执行或运行codeigniter

* * * * * /usr/bin/curl https://www.domain.com/controller/function

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM