Creating A Cronjob Alongside Codeigniter

You demand cronjob to accomplish many things. For example, if you lot demand to reset/update the database every 30min or 1 hour, you lot demand cronjob.

First practice a controller inwards the folder application/controller/. I practice a controller similar this application/controller/crontodo.php
 cast Crontodo extends CI_Controller{   business office __construct()  {   parent::__construct();   //load the model   $this->load->model('cronjob_model','',TRUE);  }   business office index()  {   $this->cronjob_model->my_cronjob();  } } 
The side past times side 1 is to practice the model every bit application/models/cronjob_model.php
 cast Cronjob_model extends CI_Model {   business office __construct()   {   // Call the Model constructor   parent::__construct();       }           business office my_cronjob(){            // hither you lot should add together what you lot wanna practice amongst cronjob such every bit drop, create, add, delete. update etc            } } 
And you lot tin dismiss prepare a cron project through a crontab.You demand to add together a URL, for instance http://www.example.com/index.php/crontodo
Sumber http://developer-paradize.blogspot.com

Comments

Popular posts from this blog

What Are The Main Components of a Computer System

Top Qualities To Look For In An IT Support Team

How To Integrate Google Adwords Api Into Codeigniter?